mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2025-01-02 18:39:16 +01:00
Initial 1.20.5 port
This commit is contained in:
parent
5c9b292d36
commit
8c64fa74a4
@ -20,6 +20,7 @@ configurations {
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
maven {
|
||||
name = "Jitpack"
|
||||
url = "https://jitpack.io"
|
||||
@ -125,8 +126,8 @@ String latestCommitHash() {
|
||||
java {
|
||||
withSourcesJar()
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
sourceCompatibility = JavaVersion.VERSION_21
|
||||
targetCompatibility = JavaVersion.VERSION_21
|
||||
}
|
||||
|
||||
jar {
|
||||
|
@ -57,14 +57,15 @@ ViaFabricPlus uses Gradle, to make sure that it is installed properly you can ch
|
||||
|
||||
=> If you are unsure if a change is relevant, ask in the ViaVersion discord, in general you should only implement changes
|
||||
which could be detected by a server side anti cheat.
|
||||
7. Check the ViaVersion/upstream protocol implementation for issues and report them if necessary or if these issues can't be fixed,
|
||||
7. Update protocol constants in the `ItemTranslator` class
|
||||
8. Check the ViaVersion/upstream protocol implementation for issues and report them if necessary or if these issues can't be fixed,
|
||||
without tons of work, implement a workaround in ViaFabricPlus.
|
||||
8. Run the game and check all GUIs and other visuals for issues.
|
||||
9. Clean your code and make sure it is readable and understandable, clientside fixes are sorted by their protocol versions, having
|
||||
9. Run the game and check all GUIs and other visuals for issues.
|
||||
10. Clean your code and make sure it is readable and understandable, clientside fixes are sorted by their protocol versions, having
|
||||
newer fixes at the top of the file.
|
||||
10. Increment the version number in `gradle.properties` by at least a minor version (e.g. 1.0.0 -> 1.1.0)
|
||||
11. Create a pull request and wait for it to be reviewed and merged.
|
||||
12. You're done, congrats!
|
||||
11. Increment the version number in `gradle.properties` by at least a minor version (e.g. 1.0.0 -> 1.1.0)
|
||||
12. Create a pull request and wait for it to be reviewed and merged.
|
||||
13. You're done, congrats!
|
||||
|
||||
## Git branches
|
||||
- `main`: The main branch, this is where all changes are merged into
|
||||
|
@ -3,18 +3,18 @@ org.gradle.jvmargs=-Xmx8G
|
||||
org.gradle.parallel=true
|
||||
|
||||
# Minecraft/Fabric
|
||||
minecraft_version=1.20.4
|
||||
yarn_mappings=1.20.4+build.3
|
||||
loader_version=0.15.7
|
||||
fabric_api_version=0.96.11+1.20.4
|
||||
minecraft_version=1.20.5-pre4
|
||||
yarn_mappings=1.20.5-pre4+build.1
|
||||
loader_version=0.15.10
|
||||
fabric_api_version=0.97.3+1.20.5
|
||||
|
||||
# Project Details
|
||||
mod_version=3.1.1-SNAPSHOT
|
||||
mod_version=3.2.0-SNAPSHOT
|
||||
maven_group=de.florianmichael
|
||||
archives_base_name=ViaFabricPlus
|
||||
|
||||
# ViaVersion Libraries
|
||||
viaversion_version=4.10.0-24w09a-SNAPSHOT
|
||||
viaversion_version=4.10.0-1.20.5-pre4-SNAPSHOT
|
||||
viabackwards_version=4.10.0-24w09a-SNAPSHOT
|
||||
vialegacy_version=2.2.22-SNAPSHOT
|
||||
viaaprilfools_version=2.0.11-SNAPSHOT
|
||||
|
@ -46,6 +46,21 @@ import java.util.concurrent.CompletableFuture;
|
||||
* - Collision hit boxes has been changed (https://github.com/ViaVersion/ViaFabricPlus/issues/195)
|
||||
* - Blip-jumping is not supported in <= 1.13.2 (https://github.com/ViaVersion/ViaFabricPlus/issues/225)
|
||||
* - Older versions don't clamp positions when teleporting (Is this important?)
|
||||
*
|
||||
* TODO | Port
|
||||
* - Readd MixinCustomPayloadS2CPacket, MixinInGameHud
|
||||
* - All Update todos
|
||||
* - Test 1.11.2 banner recipe
|
||||
* - Test 1.20.1 riding offsets
|
||||
* - Fix on protocol level: modify1_7StepHeight, modifyReachDistance
|
||||
* - EntityDimensionDiff: Add eye height and attachment point
|
||||
* - Test bedrock transfer
|
||||
* - Readd item fixes on protocol level: MixinAxeItem, MixinHoeItem, MixinPickaxeItem, MixinShearsItem, MixinShovelItem, MixinSwordItem, MixinMiningToolItem, MixinItem
|
||||
* - Readd item fixes: ArmorMaterials, MixinItemStack, MixinDrawContext, MixinPacketByteBuf
|
||||
* - Test villager trading in 1.8/1.12.2
|
||||
* - Test 1.8 triple chest
|
||||
* - Figure out how to fix 32k enchantments with codecs (MixinEnchantmentHelper)
|
||||
* - Test sign interactions
|
||||
*/
|
||||
public class ViaFabricPlus {
|
||||
|
||||
|
@ -37,6 +37,7 @@ import net.minecraft.client.font.FontStorage;
|
||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||
import net.minecraft.client.network.ServerAddress;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.network.RegistryByteBuf;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.raphimc.viabedrock.api.BedrockProtocolVersion;
|
||||
import net.raphimc.viabedrock.protocol.data.ProtocolConstants;
|
||||
@ -58,7 +59,7 @@ public class ClientsideFixes {
|
||||
/**
|
||||
* Contains all tasks that are waiting for a packet to be received, this system can be used to sync ViaVersion tasks with the correct thread
|
||||
*/
|
||||
private static final Map<String, Consumer<PacketByteBuf>> PENDING_EXECUTION_TASKS = new ConcurrentHashMap<>();
|
||||
private static final Map<String, Consumer<RegistryByteBuf>> PENDING_EXECUTION_TASKS = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* This identifier is an internal identifier that is used to identify packets that are sent by ViaFabricPlus
|
||||
@ -167,7 +168,7 @@ public class ClientsideFixes {
|
||||
* @param task The task to execute
|
||||
* @return The uuid of the task
|
||||
*/
|
||||
public static String executeSyncTask(final Consumer<PacketByteBuf> task) {
|
||||
public static String executeSyncTask(final Consumer<RegistryByteBuf> task) {
|
||||
final String uuid = UUID.randomUUID().toString();
|
||||
PENDING_EXECUTION_TASKS.put(uuid, task);
|
||||
return uuid;
|
||||
@ -179,7 +180,7 @@ public class ClientsideFixes {
|
||||
if (PENDING_EXECUTION_TASKS.containsKey(uuid)) {
|
||||
MinecraftClient.getInstance().execute(() -> { // Execute the task on the main thread
|
||||
final var task = PENDING_EXECUTION_TASKS.remove(uuid);
|
||||
task.accept(buf);
|
||||
task.accept(new RegistryByteBuf(buf, MinecraftClient.getInstance().getNetworkHandler().getRegistryManager()));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public class EntityDimensionDiff {
|
||||
),
|
||||
EntityType.ZOMBIE, linkedHashMap(
|
||||
ProtocolVersion.v1_7_6, EntityDimensions.changing(0.6F, 1.8F),
|
||||
ProtocolVersion.v1_8, EntityDimensions.fixed(EntityType.ZOMBIE.getDimensions().width, EntityType.ZOMBIE.getDimensions().height),
|
||||
ProtocolVersion.v1_8, EntityDimensions.fixed(EntityType.ZOMBIE.getDimensions().width(), EntityType.ZOMBIE.getDimensions().height()),
|
||||
ProtocolVersion.v1_9, EntityType.ZOMBIE.getDimensions()
|
||||
),
|
||||
EntityType.CHICKEN, linkedHashMap(
|
||||
|
@ -604,7 +604,7 @@ public class ItemRegistryDiff {
|
||||
ITEM_DIFF.put(BLUE_ICE, andNewer(v1_13));
|
||||
ITEM_DIFF.put(CONDUIT, andNewer(v1_13));
|
||||
ITEM_DIFF.put(TURTLE_HELMET, andNewer(v1_13));
|
||||
ITEM_DIFF.put(SCUTE, andNewer(v1_13));
|
||||
ITEM_DIFF.put(TURTLE_SCUTE, andNewer(v1_13));
|
||||
ITEM_DIFF.put(PUFFERFISH_BUCKET, andNewer(v1_13));
|
||||
ITEM_DIFF.put(SALMON_BUCKET, andNewer(v1_13));
|
||||
ITEM_DIFF.put(COD_BUCKET, andNewer(v1_13));
|
||||
|
@ -21,19 +21,19 @@ package de.florianmichael.viafabricplus.fixes.data.recipe;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.block.entity.BannerBlockEntity;
|
||||
import net.minecraft.component.DataComponentTypes;
|
||||
import net.minecraft.component.type.BannerPatternsComponent;
|
||||
import net.minecraft.inventory.RecipeInputInventory;
|
||||
import net.minecraft.item.BannerItem;
|
||||
import net.minecraft.item.DyeItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtList;
|
||||
import net.minecraft.recipe.RecipeSerializer;
|
||||
import net.minecraft.recipe.SpecialCraftingRecipe;
|
||||
import net.minecraft.recipe.SpecialRecipeSerializer;
|
||||
import net.minecraft.recipe.book.CraftingRecipeCategory;
|
||||
import net.minecraft.registry.DynamicRegistryManager;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.registry.RegistryWrapper;
|
||||
import net.minecraft.util.DyeColor;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@ -53,7 +53,7 @@ public class AddBannerPatternRecipe extends SpecialCraftingRecipe {
|
||||
if (stack.getItem() instanceof BannerItem) {
|
||||
if (foundBanner)
|
||||
return false;
|
||||
if (BannerBlockEntity.getPatternCount(stack) >= 6)
|
||||
if (stack.getOrDefault(DataComponentTypes.BANNER_PATTERNS, BannerPatternsComponent.DEFAULT).layers().size() >= 6)
|
||||
return false;
|
||||
foundBanner = true;
|
||||
}
|
||||
@ -62,7 +62,7 @@ public class AddBannerPatternRecipe extends SpecialCraftingRecipe {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack craft(RecipeInputInventory inv, DynamicRegistryManager registryManager) {
|
||||
public ItemStack craft(RecipeInputInventory inv, RegistryWrapper.WrapperLookup lookup) {
|
||||
ItemStack result = ItemStack.EMPTY;
|
||||
|
||||
for (int i = 0; i < inv.size(); i++) {
|
||||
@ -74,8 +74,9 @@ public class AddBannerPatternRecipe extends SpecialCraftingRecipe {
|
||||
}
|
||||
}
|
||||
|
||||
BannerPattern_1_13_2 pattern = getBannerPattern(inv);
|
||||
final BannerPattern_1_13_2 pattern = getBannerPattern(inv);
|
||||
if (pattern != null) {
|
||||
final var patternKey = lookup.getWrapperOrThrow(RegistryKeys.BANNER_PATTERN).getOrThrow(pattern.getKey());
|
||||
DyeColor color = ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2) ? DyeColor.BLACK : DyeColor.WHITE;
|
||||
for (int i = 0; i < inv.size(); i++) {
|
||||
Item item = inv.getStack(i).getItem();
|
||||
@ -84,18 +85,12 @@ public class AddBannerPatternRecipe extends SpecialCraftingRecipe {
|
||||
}
|
||||
}
|
||||
|
||||
NbtCompound tileEntityNbt = result.getOrCreateSubNbt("BlockEntityTag");
|
||||
NbtList patterns;
|
||||
if (tileEntityNbt.contains("Patterns", 9)) {
|
||||
patterns = tileEntityNbt.getList("Patterns", 10);
|
||||
} else {
|
||||
patterns = new NbtList();
|
||||
tileEntityNbt.put("Patterns", patterns);
|
||||
final BannerPatternsComponent.Builder patternsBuilder = new BannerPatternsComponent.Builder();
|
||||
if (result.contains(DataComponentTypes.BANNER_PATTERNS)) {
|
||||
patternsBuilder.addAll(result.get(DataComponentTypes.BANNER_PATTERNS));
|
||||
}
|
||||
NbtCompound patternNbt = new NbtCompound();
|
||||
patternNbt.putString("Pattern", pattern.getId());
|
||||
patternNbt.putInt("Color", color.getId());
|
||||
patterns.add(patternNbt);
|
||||
patternsBuilder.add(new BannerPatternsComponent.Layer(patternKey, color));
|
||||
result.set(DataComponentTypes.BANNER_PATTERNS, patternsBuilder.build());
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -20,76 +20,79 @@
|
||||
package de.florianmichael.viafabricplus.fixes.data.recipe;
|
||||
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.entity.BannerPattern;
|
||||
import net.minecraft.block.entity.BannerPatterns;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
|
||||
public enum BannerPattern_1_13_2 {
|
||||
|
||||
BASE("b"),
|
||||
SQUARE_BOTTOM_LEFT("bl", " ", " ", "# "),
|
||||
SQUARE_BOTTOM_RIGHT("br", " ", " ", " #"),
|
||||
SQUARE_TOP_LEFT("tl", "# ", " ", " "),
|
||||
SQUARE_TOP_RIGHT("tr", " #", " ", " "),
|
||||
STRIPE_BOTTOM("bs", " ", " ", "###"),
|
||||
STRIPE_TOP("ts", "###", " ", " "),
|
||||
STRIPE_LEFT("ls", "# ", "# ", "# "),
|
||||
STRIPE_RIGHT("rs", " #", " #", " #"),
|
||||
STRIPE_CENTER("cs", " # ", " # ", " # "),
|
||||
STRIPE_MIDDLE("ms", " ", "###", " "),
|
||||
STRIPE_DOWNRIGHT("drs", "# ", " # ", " #"),
|
||||
STRIPE_DOWNLEFT("dls", " #", " # ", "# "),
|
||||
STRIPE_SMALL("ss", "# #", "# #", " "),
|
||||
CROSS("cr", "# #", " # ", "# #"),
|
||||
STRAIGHT_CROSS("sc", " # ", "###", " # "),
|
||||
TRIANGLE_BOTTOM("bt", " ", " # ", "# #"),
|
||||
TRIANGLE_TOP("tt", "# #", " # ", " "),
|
||||
TRIANGLES_BOTTOM("bts", " ", "# #", " # "),
|
||||
TRIANGLES_TOP("tts", " # ", "# #", " "),
|
||||
DIAGONAL_LEFT("ld", "## ", "# ", " "),
|
||||
DIAGONAL_RIGHT("rd", " ", " #", " ##"),
|
||||
DIAGONAL_LEFT_MIRROR("lud", " ", "# ", "## "),
|
||||
DIAGONAL_RIGHT_MIRROR("rud", " ##", " #", " "),
|
||||
CIRCLE_MIDDLE("mc", " ", " # ", " "),
|
||||
RHOMBUS_MIDDLE("mr", " # ", "# #", " # "),
|
||||
HALF_VERTICAL("vh", "## ", "## ", "## "),
|
||||
HALF_HORIZONTAL("hh", "###", "###", " "),
|
||||
HALF_VERTICAL_MIRROR("vhr", " ##", " ##", " ##"),
|
||||
HALF_HORIZONTAL_MIRROR("hhb", " ", "###", "###"),
|
||||
BORDER("bo", "###", "# #", "###"),
|
||||
CURLY_BORDER("cbo", new ItemStack(Blocks.VINE)),
|
||||
GRADIENT("gra", "# #", " # ", " # "),
|
||||
GRADIENT_UP("gru", " # ", " # ", "# #"),
|
||||
BRICKS("bri", new ItemStack(Blocks.BRICKS)),
|
||||
GLOBE("glb"),
|
||||
CREEPER("cre", new ItemStack(Items.CREEPER_HEAD)),
|
||||
SKULL("sku", new ItemStack(Items.WITHER_SKELETON_SKULL)),
|
||||
FLOWER("flo", new ItemStack(Blocks.OXEYE_DAISY)),
|
||||
MOJANG("moj", new ItemStack(Items.ENCHANTED_GOLDEN_APPLE));
|
||||
BASE(BannerPatterns.BASE),
|
||||
SQUARE_BOTTOM_LEFT(BannerPatterns.SQUARE_BOTTOM_LEFT, " ", " ", "# "),
|
||||
SQUARE_BOTTOM_RIGHT(BannerPatterns.SQUARE_BOTTOM_RIGHT, " ", " ", " #"),
|
||||
SQUARE_TOP_LEFT(BannerPatterns.SQUARE_TOP_LEFT, "# ", " ", " "),
|
||||
SQUARE_TOP_RIGHT(BannerPatterns.SQUARE_TOP_RIGHT, " #", " ", " "),
|
||||
STRIPE_BOTTOM(BannerPatterns.STRIPE_BOTTOM, " ", " ", "###"),
|
||||
STRIPE_TOP(BannerPatterns.STRIPE_TOP, "###", " ", " "),
|
||||
STRIPE_LEFT(BannerPatterns.STRIPE_LEFT, "# ", "# ", "# "),
|
||||
STRIPE_RIGHT(BannerPatterns.STRIPE_RIGHT, " #", " #", " #"),
|
||||
STRIPE_CENTER(BannerPatterns.STRIPE_CENTER, " # ", " # ", " # "),
|
||||
STRIPE_MIDDLE(BannerPatterns.STRIPE_MIDDLE, " ", "###", " "),
|
||||
STRIPE_DOWNRIGHT(BannerPatterns.STRIPE_DOWNRIGHT, "# ", " # ", " #"),
|
||||
STRIPE_DOWNLEFT(BannerPatterns.STRIPE_DOWNLEFT, " #", " # ", "# "),
|
||||
STRIPE_SMALL(BannerPatterns.SMALL_STRIPES, "# #", "# #", " "),
|
||||
CROSS(BannerPatterns.CROSS, "# #", " # ", "# #"),
|
||||
STRAIGHT_CROSS(BannerPatterns.STRAIGHT_CROSS, " # ", "###", " # "),
|
||||
TRIANGLE_BOTTOM(BannerPatterns.TRIANGLE_BOTTOM, " ", " # ", "# #"),
|
||||
TRIANGLE_TOP(BannerPatterns.TRIANGLE_TOP, "# #", " # ", " "),
|
||||
TRIANGLES_BOTTOM(BannerPatterns.TRIANGLES_BOTTOM, " ", "# #", " # "),
|
||||
TRIANGLES_TOP(BannerPatterns.TRIANGLES_TOP, " # ", "# #", " "),
|
||||
DIAGONAL_LEFT(BannerPatterns.DIAGONAL_LEFT, "## ", "# ", " "),
|
||||
DIAGONAL_RIGHT(BannerPatterns.DIAGONAL_RIGHT, " ", " #", " ##"),
|
||||
DIAGONAL_LEFT_MIRROR(BannerPatterns.DIAGONAL_UP_LEFT, " ", "# ", "## "),
|
||||
DIAGONAL_RIGHT_MIRROR(BannerPatterns.DIAGONAL_UP_RIGHT, " ##", " #", " "),
|
||||
CIRCLE_MIDDLE(BannerPatterns.CIRCLE, " ", " # ", " "),
|
||||
RHOMBUS_MIDDLE(BannerPatterns.RHOMBUS, " # ", "# #", " # "),
|
||||
HALF_VERTICAL(BannerPatterns.HALF_VERTICAL, "## ", "## ", "## "),
|
||||
HALF_HORIZONTAL(BannerPatterns.HALF_HORIZONTAL, "###", "###", " "),
|
||||
HALF_VERTICAL_MIRROR(BannerPatterns.HALF_VERTICAL_RIGHT, " ##", " ##", " ##"),
|
||||
HALF_HORIZONTAL_MIRROR(BannerPatterns.HALF_HORIZONTAL_BOTTOM, " ", "###", "###"),
|
||||
BORDER(BannerPatterns.BORDER, "###", "# #", "###"),
|
||||
CURLY_BORDER(BannerPatterns.CURLY_BORDER, new ItemStack(Blocks.VINE)),
|
||||
GRADIENT(BannerPatterns.GRADIENT, "# #", " # ", " # "),
|
||||
GRADIENT_UP(BannerPatterns.GRADIENT_UP, " # ", " # ", "# #"),
|
||||
BRICKS(BannerPatterns.BRICKS, new ItemStack(Blocks.BRICKS)),
|
||||
GLOBE(BannerPatterns.GLOBE),
|
||||
CREEPER(BannerPatterns.CREEPER, new ItemStack(Items.CREEPER_HEAD)),
|
||||
SKULL(BannerPatterns.SKULL, new ItemStack(Items.WITHER_SKELETON_SKULL)),
|
||||
FLOWER(BannerPatterns.FLOWER, new ItemStack(Blocks.OXEYE_DAISY)),
|
||||
MOJANG(BannerPatterns.MOJANG, new ItemStack(Items.ENCHANTED_GOLDEN_APPLE));
|
||||
|
||||
private final String id;
|
||||
private final RegistryKey<BannerPattern> pattern;
|
||||
private final String[] recipePattern;
|
||||
private ItemStack baseStack;
|
||||
|
||||
BannerPattern_1_13_2(String id) {
|
||||
BannerPattern_1_13_2(final RegistryKey<BannerPattern> pattern) {
|
||||
this.recipePattern = new String[3];
|
||||
this.baseStack = ItemStack.EMPTY;
|
||||
this.id = id;
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
BannerPattern_1_13_2(String id, ItemStack baseStack) {
|
||||
this(id);
|
||||
BannerPattern_1_13_2(final RegistryKey<BannerPattern> pattern, final ItemStack baseStack) {
|
||||
this(pattern);
|
||||
this.baseStack = baseStack;
|
||||
}
|
||||
|
||||
BannerPattern_1_13_2(String id, String recipe1, String recipe2, String recipe3) {
|
||||
this(id);
|
||||
BannerPattern_1_13_2(final RegistryKey<BannerPattern> pattern, final String recipe1, final String recipe2, final String recipe3) {
|
||||
this(pattern);
|
||||
this.recipePattern[0] = recipe1;
|
||||
this.recipePattern[1] = recipe2;
|
||||
this.recipePattern[2] = recipe3;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return this.id;
|
||||
public RegistryKey<BannerPattern> getKey() {
|
||||
return this.pattern;
|
||||
}
|
||||
|
||||
public boolean isCraftable() {
|
||||
|
@ -34,7 +34,7 @@ import net.minecraft.entity.vehicle.AbstractMinecartEntity;
|
||||
import net.minecraft.entity.vehicle.BoatEntity;
|
||||
import net.minecraft.entity.vehicle.ChestBoatEntity;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import org.joml.Vector3f;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
/**
|
||||
* Minecraft 1.20.2 changed the calculation of the mounted height offset for all entities, this class contains the old
|
||||
@ -49,18 +49,18 @@ public class EntityRidingOffsetsPre1_20_2 {
|
||||
* @param passenger The passenger of the entity.
|
||||
* @return The mounted height offset.
|
||||
*/
|
||||
public static Vector3f getMountedHeightOffset(final Entity entity, final Entity passenger) {
|
||||
float yOffset = entity.getHeight() * 0.75F;
|
||||
public static Vec3d getMountedHeightOffset(final Entity entity, final Entity passenger) {
|
||||
double yOffset = entity.getHeight() * 0.75F;
|
||||
|
||||
if (entity instanceof BoatEntity boatEntity) {
|
||||
if (!boatEntity.hasPassenger(passenger)) return new Vector3f();
|
||||
if (!boatEntity.hasPassenger(passenger)) return Vec3d.ZERO;
|
||||
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
yOffset = -0.3F;
|
||||
final float xOffset = MathHelper.cos(boatEntity.getYaw() * MathHelper.PI / 180F);
|
||||
final float zOffset = MathHelper.sin(boatEntity.getYaw() * MathHelper.PI / 180F);
|
||||
final double xOffset = MathHelper.cos(boatEntity.getYaw() * MathHelper.PI / 180F);
|
||||
final double zOffset = MathHelper.sin(boatEntity.getYaw() * MathHelper.PI / 180F);
|
||||
|
||||
return new Vector3f(0.4F * xOffset, yOffset, 0.4F * zOffset);
|
||||
return new Vec3d(0.4F * xOffset, yOffset, 0.4F * zOffset);
|
||||
} else {
|
||||
if (boatEntity.isRemoved()) {
|
||||
yOffset = 0.01F;
|
||||
@ -68,7 +68,7 @@ public class EntityRidingOffsetsPre1_20_2 {
|
||||
yOffset = boatEntity.getVariant() == BoatEntity.Type.BAMBOO ? 0.25F : -0.1F;
|
||||
}
|
||||
|
||||
float xOffset = boatEntity instanceof ChestBoatEntity ? 0.15F : 0F;
|
||||
double xOffset = boatEntity instanceof ChestBoatEntity ? 0.15F : 0F;
|
||||
if (boatEntity.getPassengerList().size() > 1) {
|
||||
final int idx = boatEntity.getPassengerList().indexOf(passenger);
|
||||
if (idx == 0) {
|
||||
@ -80,34 +80,34 @@ public class EntityRidingOffsetsPre1_20_2 {
|
||||
if (passenger instanceof AnimalEntity) xOffset += 0.2F;
|
||||
}
|
||||
|
||||
return new Vector3f(xOffset, yOffset, 0F);
|
||||
return new Vec3d(xOffset, yOffset, 0F);
|
||||
}
|
||||
} else if (entity instanceof CamelEntity camelEntity) {
|
||||
if (!camelEntity.hasPassenger(passenger)) return new Vector3f();
|
||||
if (!camelEntity.hasPassenger(passenger)) return Vec3d.ZERO;
|
||||
|
||||
final boolean firstPassenger = camelEntity.getPassengerList().indexOf(passenger) == 0;
|
||||
yOffset = camelEntity.getDimensions(camelEntity.isSitting() ? EntityPose.SITTING : EntityPose.STANDING).height - (camelEntity.isBaby() ? 0.35F : 0.6F);
|
||||
yOffset = camelEntity.getDimensions(camelEntity.isSitting() ? EntityPose.SITTING : EntityPose.STANDING).height() - (camelEntity.isBaby() ? 0.35F : 0.6F);
|
||||
if (camelEntity.isRemoved()) {
|
||||
yOffset = 0.01F;
|
||||
} else {
|
||||
yOffset = (float) camelEntity.getPassengerAttachmentY(firstPassenger, 0F, EntityDimensions.fixed(0F, (0.375F * camelEntity.getScaleFactor()) + yOffset), camelEntity.getScaleFactor());
|
||||
yOffset = camelEntity.getPassengerAttachmentY(firstPassenger, 0F, EntityDimensions.fixed(0F, (float) ((0.375F * camelEntity.getScaleFactor()) + yOffset)), camelEntity.getScaleFactor());
|
||||
}
|
||||
|
||||
float zOffset = 0.5F;
|
||||
double zOffset = 0.5F;
|
||||
if (camelEntity.getPassengerList().size() > 1) {
|
||||
if (!firstPassenger) zOffset = -0.7F;
|
||||
if (passenger instanceof AnimalEntity) zOffset += 0.2F;
|
||||
}
|
||||
|
||||
return new Vector3f(0, yOffset, zOffset);
|
||||
return new Vec3d(0, yOffset, zOffset);
|
||||
} else if (entity instanceof ChickenEntity chickenEntity) {
|
||||
return new Vector3f(0, (float) (chickenEntity.getBodyY(0.5D) - chickenEntity.getY()), -0.1F);
|
||||
return new Vec3d(0, chickenEntity.getBodyY(0.5D) - chickenEntity.getY(), -0.1F);
|
||||
} else if (entity instanceof EnderDragonEntity enderDragonEntity) {
|
||||
yOffset = enderDragonEntity.body.getHeight();
|
||||
} else if (entity instanceof HoglinEntity hoglinEntity) {
|
||||
yOffset = hoglinEntity.getHeight() - (hoglinEntity.isBaby() ? 0.2F : 0.15F);
|
||||
} else if (entity instanceof LlamaEntity) {
|
||||
return new Vector3f(0, entity.getHeight() * 0.6F, -0.3F);
|
||||
return new Vec3d(0, entity.getHeight() * 0.6F, -0.3F);
|
||||
} else if (entity instanceof PhantomEntity) {
|
||||
yOffset = entity.getStandingEyeHeight();
|
||||
} else if (entity instanceof PiglinEntity) {
|
||||
@ -134,11 +134,11 @@ public class EntityRidingOffsetsPre1_20_2 {
|
||||
|
||||
if (entity instanceof AbstractHorseEntity abstractHorseEntity) {
|
||||
if (abstractHorseEntity.lastAngryAnimationProgress > 0.0F) {
|
||||
return new Vector3f(0, yOffset + 0.15F * abstractHorseEntity.lastAngryAnimationProgress, -0.7F * abstractHorseEntity.lastAngryAnimationProgress);
|
||||
return new Vec3d(0, yOffset + 0.15F * abstractHorseEntity.lastAngryAnimationProgress, -0.7F * abstractHorseEntity.lastAngryAnimationProgress);
|
||||
}
|
||||
}
|
||||
|
||||
return new Vector3f(0, yOffset, 0);
|
||||
return new Vec3d(0, yOffset, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,7 +27,7 @@ import net.minecraft.client.particle.*;
|
||||
import net.minecraft.client.render.Camera;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.particle.DefaultParticleType;
|
||||
import net.minecraft.particle.SimpleParticleType;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.util.Identifier;
|
||||
@ -78,7 +78,7 @@ public class FootStepParticle1_12_2 extends SpriteBillboardParticle {
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
final DefaultParticleType footStepType = FabricParticleTypes.simple(true);
|
||||
final SimpleParticleType footStepType = FabricParticleTypes.simple(true);
|
||||
|
||||
Registry.register(Registries.PARTICLE_TYPE, new Identifier("viafabricplus", "footstep"), footStepType);
|
||||
ParticleFactoryRegistry.getInstance().register(footStepType, FootStepParticle1_12_2.Factory::new);
|
||||
@ -86,7 +86,7 @@ public class FootStepParticle1_12_2 extends SpriteBillboardParticle {
|
||||
ID = Registries.PARTICLE_TYPE.getRawId(footStepType);
|
||||
}
|
||||
|
||||
public static class Factory implements ParticleFactory<DefaultParticleType> {
|
||||
public static class Factory implements ParticleFactory<SimpleParticleType> {
|
||||
|
||||
private final SpriteProvider spriteProvider;
|
||||
|
||||
@ -95,7 +95,7 @@ public class FootStepParticle1_12_2 extends SpriteBillboardParticle {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Particle createParticle(DefaultParticleType parameters, ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ) {
|
||||
public Particle createParticle(SimpleParticleType parameters, ClientWorld world, double x, double y, double z, double velocityX, double velocityY, double velocityZ) {
|
||||
if (ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_12_2)) {
|
||||
throw new UnsupportedOperationException("FootStepParticle is not supported on versions newer than 1.12.2");
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ package de.florianmichael.viafabricplus.injection.access;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
|
||||
public interface IPerformanceLog {
|
||||
public interface IMultiValueDebugSampleLogImpl {
|
||||
|
||||
ProtocolVersion viaFabricPlus$getForcedVersion();
|
||||
void viaFabricPlus$setForcedVersion(final ProtocolVersion version);
|
@ -26,7 +26,7 @@ import com.llamalad7.mixinextras.sugar.Local;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.injection.access.IClientConnection;
|
||||
import de.florianmichael.viafabricplus.injection.access.IPerformanceLog;
|
||||
import de.florianmichael.viafabricplus.injection.access.IMultiValueDebugSampleLogImpl;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.netty.ViaFabricPlusVLLegacyPipeline;
|
||||
import io.netty.bootstrap.AbstractBootstrap;
|
||||
@ -39,7 +39,7 @@ import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.network.encryption.PacketDecryptor;
|
||||
import net.minecraft.network.encryption.PacketEncryptor;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.util.profiler.PerformanceLog;
|
||||
import net.minecraft.util.profiler.MultiValueDebugSampleLogImpl;
|
||||
import net.raphimc.viabedrock.api.BedrockProtocolVersion;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import net.raphimc.vialoader.netty.CompressionReorderEvent;
|
||||
@ -122,18 +122,18 @@ public abstract class MixinClientConnection extends SimpleChannelInboundHandler<
|
||||
return !BedrockProtocolVersion.bedrockLatest.equals(this.viaFabricPlus$serverVersion);
|
||||
}
|
||||
|
||||
@Inject(method = "connect(Ljava/net/InetSocketAddress;ZLnet/minecraft/util/profiler/PerformanceLog;)Lnet/minecraft/network/ClientConnection;", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;connect(Ljava/net/InetSocketAddress;ZLnet/minecraft/network/ClientConnection;)Lio/netty/channel/ChannelFuture;", shift = At.Shift.BEFORE))
|
||||
private static void setTargetVersion(InetSocketAddress address, boolean useEpoll, PerformanceLog packetSizeLog, CallbackInfoReturnable<ClientConnection> cir, @Local ClientConnection clientConnection) {
|
||||
@Inject(method = "connect(Ljava/net/InetSocketAddress;ZLnet/minecraft/util/profiler/MultiValueDebugSampleLogImpl;)Lnet/minecraft/network/ClientConnection;", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;connect(Ljava/net/InetSocketAddress;ZLnet/minecraft/network/ClientConnection;)Lio/netty/channel/ChannelFuture;", shift = At.Shift.BEFORE))
|
||||
private static void setTargetVersion(InetSocketAddress address, boolean useEpoll, MultiValueDebugSampleLogImpl packetSizeLog, CallbackInfoReturnable<ClientConnection> cir, @Local ClientConnection clientConnection) {
|
||||
// Set the target version stored in the PerformanceLog field to the ClientConnection instance
|
||||
if (packetSizeLog instanceof IPerformanceLog mixinPerformanceLog && mixinPerformanceLog.viaFabricPlus$getForcedVersion() != null) {
|
||||
((IClientConnection) clientConnection).viaFabricPlus$setTargetVersion(mixinPerformanceLog.viaFabricPlus$getForcedVersion());
|
||||
if (packetSizeLog instanceof IMultiValueDebugSampleLogImpl mixinMultiValueDebugSampleLogImpl && mixinMultiValueDebugSampleLogImpl.viaFabricPlus$getForcedVersion() != null) {
|
||||
((IClientConnection) clientConnection).viaFabricPlus$setTargetVersion(mixinMultiValueDebugSampleLogImpl.viaFabricPlus$getForcedVersion());
|
||||
}
|
||||
}
|
||||
|
||||
@WrapWithCondition(method = "connect(Ljava/net/InetSocketAddress;ZLnet/minecraft/util/profiler/PerformanceLog;)Lnet/minecraft/network/ClientConnection;", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;resetPacketSizeLog(Lnet/minecraft/util/profiler/PerformanceLog;)V"))
|
||||
private static boolean dontSetPerformanceLog(ClientConnection instance, PerformanceLog log) {
|
||||
@WrapWithCondition(method = "connect(Ljava/net/InetSocketAddress;ZLnet/minecraft/util/profiler/MultiValueDebugSampleLogImpl;)Lnet/minecraft/network/ClientConnection;", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;resetPacketSizeLog(Lnet/minecraft/util/profiler/MultiValueDebugSampleLogImpl;)V"))
|
||||
private static boolean dontSetPerformanceLog(ClientConnection instance, MultiValueDebugSampleLogImpl packetSizeLog) {
|
||||
// We need to restore vanilla behaviour since we use the PerformanceLog as a way to store the target version
|
||||
return !(log instanceof IPerformanceLog mixinPerformanceLog) || mixinPerformanceLog.viaFabricPlus$getForcedVersion() == null;
|
||||
return !(packetSizeLog instanceof IMultiValueDebugSampleLogImpl mixinMultiValueDebugSampleLogImpl) || mixinMultiValueDebugSampleLogImpl.viaFabricPlus$getForcedVersion() == null;
|
||||
}
|
||||
|
||||
@Inject(method = "connect(Ljava/net/InetSocketAddress;ZLnet/minecraft/network/ClientConnection;)Lio/netty/channel/ChannelFuture;", at = @At("HEAD"))
|
||||
|
@ -19,9 +19,8 @@
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.base.integration;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.injection.access.IServerInfo;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
@ -53,9 +52,6 @@ public abstract class MixinMultiplayerServerListWidget_ServerEntry {
|
||||
@Final
|
||||
private ServerInfo server;
|
||||
|
||||
@Shadow
|
||||
protected abstract boolean protocolVersionMatches();
|
||||
|
||||
@Mutable
|
||||
@Shadow
|
||||
@Final
|
||||
@ -76,12 +72,12 @@ public abstract class MixinMultiplayerServerListWidget_ServerEntry {
|
||||
return !viaFabricPlus$disableServerPinging;
|
||||
}
|
||||
|
||||
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/multiplayer/MultiplayerServerListWidget$ServerEntry;protocolVersionMatches()Z"))
|
||||
private boolean disableServerPinging(MultiplayerServerListWidget.ServerEntry instance) {
|
||||
@Redirect(method = "render", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ServerInfo$Status;INCOMPATIBLE:Lnet/minecraft/client/network/ServerInfo$Status;"))
|
||||
private ServerInfo.Status disableServerPinging() {
|
||||
if (viaFabricPlus$disableServerPinging) {
|
||||
return false; // server version will always been shown (as we don't have a player count anyway)
|
||||
return this.server.getStatus(); // server version will always be shown (as we don't have a player count anyway)
|
||||
} else {
|
||||
return protocolVersionMatches();
|
||||
return ServerInfo.Status.INCOMPATIBLE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,9 +103,9 @@ public abstract class MixinMultiplayerServerListWidget_ServerEntry {
|
||||
return !viaFabricPlus$disableServerPinging; // Remove ping bar
|
||||
}
|
||||
|
||||
@WrapWithCondition(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/multiplayer/MultiplayerScreen;setMultiplayerScreenTooltip(Ljava/util/List;)V", ordinal = 1))
|
||||
@WrapWithCondition(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/multiplayer/MultiplayerScreen;setTooltip(Ljava/util/List;)V"))
|
||||
private boolean disableServerPinging(MultiplayerScreen instance, List<Text> tooltip) {
|
||||
return !viaFabricPlus$disableServerPinging; // Remove ping bar tooltip
|
||||
return !viaFabricPlus$disableServerPinging; // Remove player list tooltip
|
||||
}
|
||||
|
||||
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/world/WorldIcon;getTextureId()Lnet/minecraft/util/Identifier;"))
|
||||
@ -121,20 +117,21 @@ public abstract class MixinMultiplayerServerListWidget_ServerEntry {
|
||||
}
|
||||
}
|
||||
|
||||
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/multiplayer/MultiplayerScreen;setMultiplayerScreenTooltip(Ljava/util/List;)V", ordinal = 0))
|
||||
private void drawTranslatingState(MultiplayerScreen instance, List<Text> tooltip, Operation<Void> original) {
|
||||
if (viaFabricPlus$disableServerPinging) { // Remove player list tooltip
|
||||
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/multiplayer/MultiplayerScreen;setTooltip(Lnet/minecraft/text/Text;)V"))
|
||||
private void drawTranslatingState(MultiplayerScreen instance, Text text) {
|
||||
if (viaFabricPlus$disableServerPinging) { // Remove ping bar tooltip
|
||||
return;
|
||||
}
|
||||
final List<Text> tooltipCopy = new ArrayList<>(tooltip);
|
||||
final List<Text> tooltips = new ArrayList<>();
|
||||
tooltips.add(text);
|
||||
if (GeneralSettings.global().showAdvertisedServerVersion.getValue()) {
|
||||
final ProtocolVersion version = ((IServerInfo) server).viaFabricPlus$translatingVersion();
|
||||
if (version != null) {
|
||||
tooltipCopy.add(Text.translatable("base.viafabricplus.via_translates_to", version.getName() + " (" + version.getOriginalVersion() + ")"));
|
||||
tooltipCopy.add(Text.translatable("base.viafabricplus.server_version", server.version.getString() + " (" + server.protocolVersion + ")"));
|
||||
tooltips.add(Text.translatable("base.viafabricplus.via_translates_to", version.getName() + " (" + version.getOriginalVersion() + ")"));
|
||||
tooltips.add(Text.translatable("base.viafabricplus.server_version", server.version.getString() + " (" + server.protocolVersion + ")"));
|
||||
}
|
||||
}
|
||||
original.call(instance, tooltipCopy);
|
||||
instance.setTooltip(Lists.transform(tooltips, Text::asOrderedText));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,13 +20,13 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.base.perserverversion;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.injection.access.IPerformanceLog;
|
||||
import net.minecraft.util.profiler.PerformanceLog;
|
||||
import de.florianmichael.viafabricplus.injection.access.IMultiValueDebugSampleLogImpl;
|
||||
import net.minecraft.util.profiler.MultiValueDebugSampleLogImpl;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
|
||||
@Mixin(PerformanceLog.class)
|
||||
public abstract class MixinPerformanceLog implements IPerformanceLog {
|
||||
@Mixin(MultiValueDebugSampleLogImpl.class)
|
||||
public abstract class MixinMultiValueDebugSampleLogImpl implements IMultiValueDebugSampleLogImpl {
|
||||
|
||||
@Unique
|
||||
private ProtocolVersion viaFabricPlus$forcedVersion;
|
@ -20,15 +20,14 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.base.perserverversion;
|
||||
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.fixes.ClientsideFixes;
|
||||
import de.florianmichael.viafabricplus.injection.access.IPerformanceLog;
|
||||
import de.florianmichael.viafabricplus.injection.access.IMultiValueDebugSampleLogImpl;
|
||||
import de.florianmichael.viafabricplus.injection.access.IServerInfo;
|
||||
import net.minecraft.client.network.MultiplayerServerListPinger;
|
||||
import net.minecraft.client.network.ServerAddress;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.util.profiler.PerformanceLog;
|
||||
import net.minecraft.util.profiler.MultiValueDebugSampleLogImpl;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
@ -44,8 +43,8 @@ public abstract class MixinMultiplayerServerListPinger {
|
||||
return ClientsideFixes.replaceDefaultPort(address, ((IServerInfo) entry).viaFabricPlus$forcedVersion());
|
||||
}
|
||||
|
||||
@Redirect(method = "add", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;connect(Ljava/net/InetSocketAddress;ZLnet/minecraft/util/profiler/PerformanceLog;)Lnet/minecraft/network/ClientConnection;"))
|
||||
private ClientConnection setForcedVersion(InetSocketAddress address, boolean useEpoll, PerformanceLog packetSizeLog, @Local(argsOnly = true) ServerInfo serverInfo) {
|
||||
@Redirect(method = "add", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ClientConnection;connect(Ljava/net/InetSocketAddress;ZLnet/minecraft/util/profiler/MultiValueDebugSampleLogImpl;)Lnet/minecraft/network/ClientConnection;"))
|
||||
private ClientConnection setForcedVersion(InetSocketAddress address, boolean useEpoll, MultiValueDebugSampleLogImpl packetSizeLog, @Local(argsOnly = true) ServerInfo serverInfo) {
|
||||
final IServerInfo mixinServerInfo = (IServerInfo) serverInfo;
|
||||
|
||||
if (mixinServerInfo.viaFabricPlus$forcedVersion() != null && !mixinServerInfo.viaFabricPlus$passedDirectConnectScreen()) {
|
||||
@ -53,11 +52,11 @@ public abstract class MixinMultiplayerServerListPinger {
|
||||
// So we can create a dummy instance, store the forced version in it and later destroy the instance again
|
||||
// To avoid any side effects, we also support cases where a mod is also creating a PerformanceLog instance
|
||||
if (packetSizeLog == null) {
|
||||
packetSizeLog = new PerformanceLog();
|
||||
packetSizeLog = new MultiValueDebugSampleLogImpl(1);
|
||||
}
|
||||
|
||||
// Attach the forced version to the PerformanceLog instance
|
||||
((IPerformanceLog) packetSizeLog).viaFabricPlus$setForcedVersion(mixinServerInfo.viaFabricPlus$forcedVersion());
|
||||
((IMultiValueDebugSampleLogImpl) packetSizeLog).viaFabricPlus$setForcedVersion(mixinServerInfo.viaFabricPlus$forcedVersion());
|
||||
mixinServerInfo.viaFabricPlus$passDirectConnectScreen(false);
|
||||
}
|
||||
|
||||
|
@ -20,8 +20,8 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.compat.classic4j;
|
||||
|
||||
import de.florianmichael.viafabricplus.injection.access.ITextFieldWidget;
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
import net.minecraft.util.StringHelper;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@ -37,17 +37,17 @@ public abstract class MixinTextFieldWidget implements ITextFieldWidget {
|
||||
@Unique
|
||||
private boolean viaFabricPlus$forbiddenCharactersUnlocked = false;
|
||||
|
||||
@Redirect(method = "charTyped", at = @At(value = "INVOKE", target = "Lnet/minecraft/SharedConstants;isValidChar(C)Z"))
|
||||
@Redirect(method = "charTyped", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/StringHelper;isValidChar(C)Z"))
|
||||
private boolean allowForbiddenCharacters(char c) {
|
||||
return this.viaFabricPlus$forbiddenCharactersUnlocked || SharedConstants.isValidChar(c);
|
||||
return this.viaFabricPlus$forbiddenCharactersUnlocked || StringHelper.isValidChar(c);
|
||||
}
|
||||
|
||||
@Redirect(method = "write", at = @At(value = "INVOKE", target = "Lnet/minecraft/SharedConstants;stripInvalidChars(Ljava/lang/String;)Ljava/lang/String;"))
|
||||
@Redirect(method = "write", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/StringHelper;stripInvalidChars(Ljava/lang/String;)Ljava/lang/String;"))
|
||||
private String allowForbiddenCharacters(String string) {
|
||||
if (this.viaFabricPlus$forbiddenCharactersUnlocked) {
|
||||
return string;
|
||||
} else {
|
||||
return SharedConstants.stripInvalidChars(string);
|
||||
return StringHelper.stripInvalidChars(string);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
*
|
||||
* Fixes https://github.com/ViaVersion/ViaFabricPlus/issues/209
|
||||
*/
|
||||
@SuppressWarnings("UnresolvedMixinReference")
|
||||
@Pseudo
|
||||
@Mixin(targets = "org.anti_ad.mc.ipnext.event.AutoRefillHandler$ItemSlotMonitor", remap = false)
|
||||
public abstract class MixinAutoRefillHandler_ItemSlotMonitor {
|
||||
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2024 FlorianMichael/EnZaXD <florian.michael07@gmail.com> and RK_01/RaphiMC
|
||||
* Copyright (C) 2023-2024 contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
@Mixin(EnchantmentHelper.class)
|
||||
public abstract class MixinEnchantmentHelper {
|
||||
|
||||
@ModifyConstant(method = "getLevelFromNbt", constant = @Constant(intValue = 0))
|
||||
private static int usePossibleMinLevel(int constant) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
|
||||
return Short.MIN_VALUE;
|
||||
} else {
|
||||
return constant;
|
||||
}
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "getLevelFromNbt", constant = @Constant(intValue = 255))
|
||||
private static int usePossibleMaxLevel(int constant) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
|
||||
return Short.MAX_VALUE;
|
||||
} else {
|
||||
return constant;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -19,7 +19,6 @@
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
|
||||
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import de.florianmichael.viafabricplus.fixes.data.RenderableGlyphDiff;
|
||||
import de.florianmichael.viafabricplus.fixes.versioned.visual.BuiltinEmptyGlyph1_12_2;
|
||||
import de.florianmichael.viafabricplus.settings.impl.VisualSettings;
|
||||
@ -36,8 +35,6 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mixin(FontStorage.class)
|
||||
public abstract class MixinFontStorage {
|
||||
|
||||
@ -54,20 +51,20 @@ public abstract class MixinFontStorage {
|
||||
@Unique
|
||||
private GlyphRenderer viaFabricPlus$blankGlyphRenderer1_12_2;
|
||||
|
||||
@Inject(method = "setFonts", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/BuiltinEmptyGlyph;bake(Ljava/util/function/Function;)Lnet/minecraft/client/font/GlyphRenderer;", ordinal = 0))
|
||||
private void bakeBlankGlyph1_12_2(List<Font> fonts, CallbackInfo ci) {
|
||||
@Inject(method = "clear", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/BuiltinEmptyGlyph;bake(Ljava/util/function/Function;)Lnet/minecraft/client/font/GlyphRenderer;", ordinal = 0))
|
||||
private void bakeBlankGlyph1_12_2(CallbackInfo ci) {
|
||||
this.viaFabricPlus$blankGlyphRenderer1_12_2 = BuiltinEmptyGlyph1_12_2.INSTANCE.bake(this::getGlyphRenderer);
|
||||
}
|
||||
|
||||
@Inject(method = "findGlyph", at = @At("RETURN"), cancellable = true)
|
||||
private void filterGlyphs1(int codePoint, CallbackInfoReturnable<FontStorage.GlyphPair> cir, @Local Font font) {
|
||||
private void filterGlyphs1(int codePoint, CallbackInfoReturnable<FontStorage.GlyphPair> cir) {
|
||||
if (this.viaFabricPlus$shouldBeInvisible(codePoint)) {
|
||||
cir.setReturnValue(this.viaFabricPlus$getBlankGlyphPair());
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "findGlyphRenderer", at = @At("RETURN"), cancellable = true)
|
||||
private void filterGlyphs2(int codePoint, CallbackInfoReturnable<GlyphRenderer> cir, @Local Font font) {
|
||||
private void filterGlyphs2(int codePoint, CallbackInfoReturnable<GlyphRenderer> cir) {
|
||||
if (this.viaFabricPlus$shouldBeInvisible(codePoint)) {
|
||||
cir.setReturnValue(this.viaFabricPlus$getBlankGlyphRenderer());
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public abstract class MixinGameRenderer {
|
||||
@Final
|
||||
MinecraftClient client;
|
||||
|
||||
@ModifyExpressionValue(method = "updateTargetedEntity", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;raycast(DFZ)Lnet/minecraft/util/hit/HitResult;"))
|
||||
@ModifyExpressionValue(method = "findCrosshairTarget", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;raycast(DFZ)Lnet/minecraft/util/hit/HitResult;"))
|
||||
private HitResult bedrockReachAroundRaycast(HitResult hitResult) {
|
||||
if (ProtocolTranslator.getTargetVersion().equals(BedrockProtocolVersion.bedrockLatest)) {
|
||||
final Entity entity = this.client.getCameraEntity();
|
||||
|
@ -28,8 +28,8 @@ import net.minecraft.item.DyeItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.ItemActionResult;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
@ -41,15 +41,15 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
@Mixin(AbstractSignBlock.class)
|
||||
public abstract class MixinAbstractSignBlock {
|
||||
|
||||
@Inject(method = "onUse", at = @At("HEAD"), cancellable = true)
|
||||
private void changeInteractionCalculation(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit, CallbackInfoReturnable<ActionResult> cir) {
|
||||
@Inject(method = "onUseWithItem", at = @At("HEAD"), cancellable = true)
|
||||
private void changeInteractionCalculation(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit, CallbackInfoReturnable<ItemActionResult> cir) {
|
||||
if (!world.isClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
|
||||
// <= 1.14.4 doesn't have any sign interactions.
|
||||
cir.setReturnValue(ActionResult.SUCCESS);
|
||||
cir.setReturnValue(ItemActionResult.SUCCESS);
|
||||
} else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_4)) {
|
||||
// Removes the isWaxed() condition and reverts the interaction changes from 1.19.4 -> 1.20 when signs
|
||||
// got a front and back side.
|
||||
@ -57,7 +57,7 @@ public abstract class MixinAbstractSignBlock {
|
||||
final Item item = itemStack.getItem();
|
||||
final boolean isSuccess = (item instanceof DyeItem || itemStack.isOf(Items.GLOW_INK_SAC) || itemStack.isOf(Items.INK_SAC)) && player.canModifyBlocks();
|
||||
|
||||
cir.setReturnValue(isSuccess ? ActionResult.SUCCESS : ActionResult.CONSUME);
|
||||
cir.setReturnValue(isSuccess ? ItemActionResult.SUCCESS : ItemActionResult.CONSUME);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,8 +24,9 @@ import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.DecoratedPotBlock;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.ItemActionResult;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
@ -37,10 +38,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
@Mixin(DecoratedPotBlock.class)
|
||||
public abstract class MixinDecoratedPotBlock {
|
||||
|
||||
@Inject(method = "onUse", at = @At("HEAD"), cancellable = true)
|
||||
private void alwaysPass(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit, CallbackInfoReturnable<ActionResult> cir) {
|
||||
@Inject(method = "onUseWithItem", at = @At("HEAD"), cancellable = true)
|
||||
private void alwaysPass(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit, CallbackInfoReturnable<ItemActionResult> cir) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_2)) {
|
||||
cir.setReturnValue(ActionResult.PASS);
|
||||
cir.setReturnValue(ItemActionResult.SKIP_DEFAULT_BLOCK_INTERACTION);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.ItemActionResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
@ -51,10 +51,10 @@ public abstract class MixinFenceBlock extends HorizontalConnectingBlock {
|
||||
super(radius1, radius2, boundingHeight1, boundingHeight2, collisionHeight, settings);
|
||||
}
|
||||
|
||||
@Inject(method = "onUse", at = @At("HEAD"), cancellable = true)
|
||||
private void alwaysSuccess(CallbackInfoReturnable<ActionResult> cir) {
|
||||
@Inject(method = "onUseWithItem", at = @At("HEAD"), cancellable = true)
|
||||
private void alwaysSuccess(CallbackInfoReturnable<ItemActionResult> cir) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_10)) {
|
||||
cir.setReturnValue(ActionResult.SUCCESS);
|
||||
cir.setReturnValue(ItemActionResult.SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ public abstract class MixinFenceBlock extends HorizontalConnectingBlock {
|
||||
final VoxelShape southShape = Block.createCuboidShape(h, (float) 0.0, h, i, height, 16.0);
|
||||
final VoxelShape westShape = Block.createCuboidShape(0.0, (float) 0.0, h, i, height, i);
|
||||
final VoxelShape eastShape = Block.createCuboidShape(h, (float) 0.0, h, 16.0, height, i);
|
||||
final VoxelShape[] voxelShapes = new VoxelShape[] {
|
||||
final VoxelShape[] voxelShapes = new VoxelShape[]{
|
||||
VoxelShapes.empty(),
|
||||
Block.createCuboidShape(f, (float) 0.0, h, g, height, 16.0D),
|
||||
Block.createCuboidShape(0.0D, (float) 0.0, f, i, height, g),
|
||||
|
@ -22,7 +22,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.block;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.block.NoteBlock;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.ItemActionResult;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
@ -31,10 +31,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
@Mixin(NoteBlock.class)
|
||||
public abstract class MixinNoteBlock {
|
||||
|
||||
@Inject(method = "onUse", at = @At("HEAD"), cancellable = true)
|
||||
private void cancelMobHeadUsage(CallbackInfoReturnable<ActionResult> cir) {
|
||||
@Inject(method = "onUseWithItem", at = @At("HEAD"), cancellable = true)
|
||||
private void cancelMobHeadUsage(CallbackInfoReturnable<ItemActionResult> cir) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_4)) {
|
||||
cir.setReturnValue(ActionResult.SUCCESS);
|
||||
cir.setReturnValue(ItemActionResult.SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -291,7 +291,7 @@ public abstract class MixinBoatEntity extends VehicleEntity {
|
||||
@Inject(method = "updatePassengerPosition", at = @At(value = "HEAD"), cancellable = true)
|
||||
private void updatePassengerPosition1_8(Entity passenger, PositionUpdater positionUpdater, CallbackInfo ci) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
final Vec3d newPosition = new Vec3d(EntityRidingOffsetsPre1_20_2.getMountedHeightOffset(this, passenger)).add(this.getPos());
|
||||
final Vec3d newPosition = EntityRidingOffsetsPre1_20_2.getMountedHeightOffset(this, passenger).add(this.getPos());
|
||||
positionUpdater.accept(passenger, newPosition.x, newPosition.y + EntityRidingOffsetsPre1_20_2.getHeightOffset(passenger), newPosition.z);
|
||||
ci.cancel();
|
||||
}
|
||||
|
@ -39,7 +39,6 @@ import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import org.joml.Vector3f;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
@ -70,22 +69,27 @@ public abstract class MixinEntity implements IEntity {
|
||||
public abstract void setVelocity(Vec3d velocity);
|
||||
|
||||
@Shadow
|
||||
protected abstract Vector3f getPassengerAttachmentPos(Entity passenger, EntityDimensions dimensions, float scaleFactor);
|
||||
protected abstract Vec3d getPassengerAttachmentPos(Entity passenger, EntityDimensions dimensions, float scaleFactor);
|
||||
|
||||
@Shadow
|
||||
public abstract float getYaw();
|
||||
|
||||
@Unique
|
||||
private boolean viaFabricPlus$isInLoadedChunkAndShouldTick;
|
||||
|
||||
@Inject(method = "getRidingOffset", at = @At("HEAD"), cancellable = true)
|
||||
private void getRidingOffset1_20_1(Entity vehicle, CallbackInfoReturnable<Float> cir) {
|
||||
@Redirect(method = "updatePassengerPosition(Lnet/minecraft/entity/Entity;Lnet/minecraft/entity/Entity$PositionUpdater;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getVehicleAttachmentPos(Lnet/minecraft/entity/Entity;)Lnet/minecraft/util/math/Vec3d;"))
|
||||
private Vec3d use1_20_1RidingOffset(Entity instance, Entity vehicle) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20)) {
|
||||
cir.setReturnValue((float) EntityRidingOffsetsPre1_20_2.getHeightOffset((Entity) (Object) this));
|
||||
return new Vec3d(0, -EntityRidingOffsetsPre1_20_2.getHeightOffset((Entity) (Object) this), 0);
|
||||
} else {
|
||||
return instance.getVehicleAttachmentPos(vehicle);
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "getPassengerRidingPos", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getPassengerAttachmentPos(Lnet/minecraft/entity/Entity;Lnet/minecraft/entity/EntityDimensions;F)Lorg/joml/Vector3f;"))
|
||||
private Vector3f getPassengerRidingPos1_20_1(Entity instance, Entity passenger, EntityDimensions dimensions, float scaleFactor) {
|
||||
@Redirect(method = "getPassengerRidingPos", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getPassengerAttachmentPos(Lnet/minecraft/entity/Entity;Lnet/minecraft/entity/EntityDimensions;F)Lnet/minecraft/util/math/Vec3d;"))
|
||||
private Vec3d getPassengerRidingPos1_20_1(Entity instance, Entity passenger, EntityDimensions dimensions, float scaleFactor) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20)) {
|
||||
return EntityRidingOffsetsPre1_20_2.getMountedHeightOffset(instance, passenger);
|
||||
return EntityRidingOffsetsPre1_20_2.getMountedHeightOffset(instance, passenger).rotateY(-this.getYaw() * (float) (Math.PI / 180));
|
||||
} else {
|
||||
return getPassengerAttachmentPos(passenger, dimensions, scaleFactor);
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.registry.entry.RegistryEntry;
|
||||
import net.minecraft.registry.tag.BlockTags;
|
||||
import net.minecraft.registry.tag.FluidTags;
|
||||
import net.minecraft.registry.tag.TagKey;
|
||||
@ -41,7 +42,6 @@ import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.raphimc.viabedrock.api.BedrockProtocolVersion;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import org.joml.Vector3f;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.*;
|
||||
@ -66,26 +66,19 @@ public abstract class MixinLivingEntity extends Entity {
|
||||
protected abstract boolean canEnterTrapdoor(BlockPos pos, BlockState state);
|
||||
|
||||
@Shadow
|
||||
public abstract boolean hasStatusEffect(StatusEffect effect);
|
||||
private int jumpingCooldown;
|
||||
|
||||
@Shadow
|
||||
private int jumpingCooldown;
|
||||
public abstract boolean hasStatusEffect(RegistryEntry<StatusEffect> effect);
|
||||
|
||||
public MixinLivingEntity(EntityType<?> type, World world) {
|
||||
super(type, world);
|
||||
}
|
||||
|
||||
@Inject(method = "getRidingOffset", at = @At("HEAD"), cancellable = true)
|
||||
private void getRidingOffset1_20_1(Entity vehicle, CallbackInfoReturnable<Float> cir) {
|
||||
@Redirect(method = "getPassengerRidingPos", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getPassengerAttachmentPos(Lnet/minecraft/entity/Entity;Lnet/minecraft/entity/EntityDimensions;F)Lnet/minecraft/util/math/Vec3d;"))
|
||||
private Vec3d getPassengerRidingPos1_20_1(LivingEntity instance, Entity entity, EntityDimensions entityDimensions, float v) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20)) {
|
||||
cir.setReturnValue((float) EntityRidingOffsetsPre1_20_2.getHeightOffset(this));
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "getPassengerRidingPos", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getPassengerAttachmentPos(Lnet/minecraft/entity/Entity;Lnet/minecraft/entity/EntityDimensions;F)Lorg/joml/Vector3f;"))
|
||||
private Vector3f getPassengerRidingPos1_20_1(LivingEntity instance, Entity entity, EntityDimensions entityDimensions, float v) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20)) {
|
||||
return EntityRidingOffsetsPre1_20_2.getMountedHeightOffset(instance, entity);
|
||||
return EntityRidingOffsetsPre1_20_2.getMountedHeightOffset(instance, entity).rotateY(-this.getYaw() * (float) (Math.PI / 180));
|
||||
} else {
|
||||
return getPassengerAttachmentPos(entity, entityDimensions, v);
|
||||
}
|
||||
@ -140,7 +133,7 @@ public abstract class MixinLivingEntity extends Entity {
|
||||
}
|
||||
|
||||
@Redirect(method = "travel",
|
||||
slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/entity/effect/StatusEffects;DOLPHINS_GRACE:Lnet/minecraft/entity/effect/StatusEffect;")),
|
||||
slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/entity/effect/StatusEffects;DOLPHINS_GRACE:Lnet/minecraft/registry/entry/RegistryEntry;")),
|
||||
at = @At(value = "FIELD", target = "Lnet/minecraft/entity/LivingEntity;horizontalCollision:Z", ordinal = 0))
|
||||
private boolean disableClimbing(LivingEntity instance) {
|
||||
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_13_2) && instance.horizontalCollision;
|
||||
@ -210,13 +203,6 @@ public abstract class MixinLivingEntity extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
private void modify1_7StepHeight(EntityType<? extends LivingEntity> type, World world, CallbackInfo ci) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_7_6)) {
|
||||
this.setStepHeight(0.5F);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "tickMovement", at = @At("HEAD"))
|
||||
private void removeJumpDelay1_0(CallbackInfo ci) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThan(LegacyProtocolVersion.r1_0_0tor1_0_1)) {
|
||||
|
@ -37,6 +37,7 @@ import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.item.ElytraItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.registry.entry.RegistryEntry;
|
||||
import net.minecraft.sound.SoundEvent;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Identifier;
|
||||
@ -46,11 +47,12 @@ import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.*;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@SuppressWarnings("ConstantValue")
|
||||
@Mixin(PlayerEntity.class)
|
||||
public abstract class MixinPlayerEntity extends LivingEntity {
|
||||
|
||||
@ -63,10 +65,10 @@ public abstract class MixinPlayerEntity extends LivingEntity {
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private PlayerInventory inventory;
|
||||
PlayerInventory inventory;
|
||||
|
||||
@Unique
|
||||
private static final EntityDimensions viaFabricPlus$sneaking_dimensions_v1_13_2 = EntityDimensions.changing(0.6F, 1.65F);
|
||||
private static final EntityDimensions viaFabricPlus$sneaking_dimensions_v1_13_2 = EntityDimensions.changing(0.6F, 1.65F).withEyeHeight(1.54F);
|
||||
|
||||
@Unique
|
||||
private static final SoundEvent viaFabricPlus$oof_hurt = SoundEvent.of(new Identifier("viafabricplus", "oof.hurt"));
|
||||
@ -102,9 +104,9 @@ public abstract class MixinPlayerEntity extends LivingEntity {
|
||||
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_15_2);
|
||||
}
|
||||
|
||||
@Redirect(method = "checkFallFlying", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;hasStatusEffect(Lnet/minecraft/entity/effect/StatusEffect;)Z"))
|
||||
private boolean allowElytraWhenLevitating(PlayerEntity instance, StatusEffect statusEffect) {
|
||||
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_15_2) && instance.hasStatusEffect(statusEffect);
|
||||
@Redirect(method = "checkFallFlying", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;hasStatusEffect(Lnet/minecraft/registry/entry/RegistryEntry;)Z"))
|
||||
private boolean allowElytraWhenLevitating(PlayerEntity instance, RegistryEntry<StatusEffect> registryEntry) {
|
||||
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_15_2) && instance.hasStatusEffect(registryEntry);
|
||||
}
|
||||
|
||||
@Inject(method = "checkFallFlying", at = @At("HEAD"), cancellable = true)
|
||||
@ -121,15 +123,6 @@ public abstract class MixinPlayerEntity extends LivingEntity {
|
||||
}
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "getActiveEyeHeight", constant = @Constant(floatValue = 1.27f))
|
||||
private float modifySneakEyeHeight(float prevEyeHeight) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
|
||||
return 1.54F;
|
||||
} else {
|
||||
return prevEyeHeight;
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "updatePose", at = @At("HEAD"), cancellable = true)
|
||||
private void onUpdatePose(CallbackInfo ci) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
|
||||
@ -152,7 +145,7 @@ public abstract class MixinPlayerEntity extends LivingEntity {
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getDimensions", at = @At("HEAD"), cancellable = true)
|
||||
@Inject(method = "getBaseDimensions", at = @At("HEAD"), cancellable = true)
|
||||
private void modifyDimensions(EntityPose pose, CallbackInfoReturnable<EntityDimensions> cir) {
|
||||
if (pose == EntityPose.CROUCHING) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
@ -208,8 +201,8 @@ public abstract class MixinPlayerEntity extends LivingEntity {
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "getBlockBreakingSpeed", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;hasStatusEffect(Lnet/minecraft/entity/effect/StatusEffect;)Z"))
|
||||
private boolean changeSpeedCalculation(PlayerEntity instance, StatusEffect statusEffect, @Local LocalFloatRef f) {
|
||||
@Redirect(method = "getBlockBreakingSpeed", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;hasStatusEffect(Lnet/minecraft/registry/entry/RegistryEntry;)Z"))
|
||||
private boolean changeSpeedCalculation(PlayerEntity instance, RegistryEntry<StatusEffect> statusEffect, @Local LocalFloatRef f) {
|
||||
final boolean hasMiningFatigue = instance.hasStatusEffect(statusEffect);
|
||||
if (hasMiningFatigue && ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_7_6)) {
|
||||
f.set(f.get() * (1.0F - (this.getStatusEffect(StatusEffects.MINING_FATIGUE).getAmplifier() + 1) * 0.2F));
|
||||
@ -219,11 +212,4 @@ public abstract class MixinPlayerEntity extends LivingEntity {
|
||||
return hasMiningFatigue;
|
||||
}
|
||||
|
||||
@Inject(method = "getReachDistance", at = @At("RETURN"), cancellable = true)
|
||||
private static void modifyReachDistance(boolean creative, CallbackInfoReturnable<Float> cir) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThan(LegacyProtocolVersion.r1_0_0tor1_0_1) && !creative) {
|
||||
cir.setReturnValue(4F);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,6 +22,8 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.fixes.tracker.WolfHealthTracker;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.component.DataComponentTypes;
|
||||
import net.minecraft.component.type.FoodComponent;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.mob.Angerable;
|
||||
import net.minecraft.entity.passive.TameableEntity;
|
||||
@ -50,7 +52,7 @@ public abstract class MixinWolfEntity extends TameableEntity implements Angerabl
|
||||
public abstract DyeColor getCollarColor();
|
||||
|
||||
@Shadow
|
||||
public abstract void setCollarColor(DyeColor color);
|
||||
protected abstract void setCollarColor(DyeColor color);
|
||||
|
||||
protected MixinWolfEntity(EntityType<? extends TameableEntity> entityType, World world) {
|
||||
super(entityType, world);
|
||||
@ -62,10 +64,11 @@ public abstract class MixinWolfEntity extends TameableEntity implements Angerabl
|
||||
final ItemStack itemStack = player.getStackInHand(hand);
|
||||
final Item item = itemStack.getItem();
|
||||
if (this.isTamed()) {
|
||||
if (item.isFood()) {
|
||||
if (item.getFoodComponent().isMeat() && this.viaFabricPlus$getWolfHealth() < 20.0F) {
|
||||
final FoodComponent foodComponent = itemStack.get(DataComponentTypes.FOOD);
|
||||
if (foodComponent != null) {
|
||||
if (this.isBreedingItem(itemStack) && this.viaFabricPlus$getWolfHealth() < 20.0F) {
|
||||
if (!player.getAbilities().creativeMode) itemStack.decrement(1);
|
||||
this.heal((float) item.getFoodComponent().getHunger());
|
||||
this.heal(foodComponent.nutrition());
|
||||
cir.setReturnValue(ActionResult.SUCCESS);
|
||||
return;
|
||||
}
|
||||
|
@ -19,13 +19,10 @@
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
|
||||
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.google.common.base.Suppliers;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import de.florianmichael.viafabricplus.settings.impl.DebugSettings;
|
||||
import net.minecraft.entity.attribute.EntityAttribute;
|
||||
import net.minecraft.entity.attribute.EntityAttributeModifier;
|
||||
import net.minecraft.component.type.AttributeModifiersComponent;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ArmorItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -43,15 +40,17 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@Mixin(ArmorItem.class)
|
||||
public abstract class MixinArmorItem {
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private Multimap<EntityAttribute, EntityAttributeModifier> attributeModifiers;
|
||||
private Supplier<AttributeModifiersComponent> attributeModifiers;
|
||||
|
||||
@Unique
|
||||
private final Multimap<EntityAttribute, EntityAttributeModifier> viaFabricPlus$AttributeModifiers_r1_8 = ImmutableMultimap.of();
|
||||
private final Supplier<AttributeModifiersComponent> viaFabricPlus$AttributeModifiers_r1_8 = Suppliers.memoize(() -> AttributeModifiersComponent.DEFAULT);
|
||||
|
||||
@Inject(method = "use", at = @At("HEAD"), cancellable = true)
|
||||
private void disableRightClick(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable<TypedActionResult<ItemStack>> cir) {
|
||||
@ -60,8 +59,8 @@ public abstract class MixinArmorItem {
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "getAttributeModifiers", at = @At(value = "FIELD", target = "Lnet/minecraft/item/ArmorItem;attributeModifiers:Lcom/google/common/collect/Multimap;"))
|
||||
private Multimap<EntityAttribute, EntityAttributeModifier> changeAttributeModifiers(ArmorItem instance) {
|
||||
@Redirect(method = "getAttributeModifiers", at = @At(value = "FIELD", target = "Lnet/minecraft/item/ArmorItem;attributeModifiers:Ljava/util/function/Supplier;"))
|
||||
private Supplier<AttributeModifiersComponent> changeAttributeModifiers(ArmorItem instance) {
|
||||
if (DebugSettings.global().replaceAttributeModifiers.isEnabled()) {
|
||||
return this.viaFabricPlus$AttributeModifiers_r1_8;
|
||||
} else {
|
||||
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2024 FlorianMichael/EnZaXD <florian.michael07@gmail.com> and RK_01/RaphiMC
|
||||
* Copyright (C) 2023-2024 contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
|
||||
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.item.ArmorMaterials;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(ArmorMaterials.class)
|
||||
public abstract class MixinArmorMaterials {
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private int durabilityMultiplier;
|
||||
|
||||
@Redirect(method = "getDurability", at = @At(value = "FIELD", target = "Lnet/minecraft/item/ArmorMaterials;durabilityMultiplier:I"))
|
||||
private int changeDurabilityMultiplier(ArmorMaterials instance) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) {
|
||||
if (instance == ArmorMaterials.LEATHER) {
|
||||
return 3;
|
||||
} else if (instance == ArmorMaterials.CHAIN || instance == ArmorMaterials.GOLD) {
|
||||
return 6;
|
||||
} else if (instance == ArmorMaterials.IRON) {
|
||||
return 12;
|
||||
} else if (instance == ArmorMaterials.DIAMOND) {
|
||||
return 24;
|
||||
}
|
||||
}
|
||||
return this.durabilityMultiplier;
|
||||
}
|
||||
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2024 FlorianMichael/EnZaXD <florian.michael07@gmail.com> and RK_01/RaphiMC
|
||||
* Copyright (C) 2023-2024 contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.fixes.data.Material1_19_4;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.registry.tag.TagKey;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Mixin(AxeItem.class)
|
||||
public abstract class MixinAxeItem extends MiningToolItem {
|
||||
|
||||
@Unique
|
||||
private static final Set<Block> viaFabricPlus$effective_blocks_b1_8_1 = ImmutableSet.of(Blocks.OAK_PLANKS, Blocks.BOOKSHELF, Blocks.OAK_LOG, Blocks.CHEST);
|
||||
|
||||
@Unique
|
||||
private static final Set<Block> viaFabricPlus$effective_blocks_r1_16_5 = ImmutableSet.of(Blocks.LADDER, Blocks.SCAFFOLDING, Blocks.OAK_BUTTON, Blocks.SPRUCE_BUTTON, Blocks.BIRCH_BUTTON, Blocks.JUNGLE_BUTTON, Blocks.DARK_OAK_BUTTON, Blocks.ACACIA_BUTTON, Blocks.CRIMSON_BUTTON, Blocks.WARPED_BUTTON);
|
||||
|
||||
@Unique
|
||||
private static final Set<Material1_19_4> viaFabricPlus$effective_materials_r1_16_5 = ImmutableSet.of(Material1_19_4.WOOD, Material1_19_4.NETHER_WOOD, Material1_19_4.PLANT, Material1_19_4.REPLACEABLE_PLANT, Material1_19_4.BAMBOO, Material1_19_4.GOURD);
|
||||
|
||||
public MixinAxeItem(float attackDamage, float attackSpeed, ToolMaterial material, TagKey<Block> effectiveBlocks, Settings settings) {
|
||||
super(attackDamage, attackSpeed, material, effectiveBlocks, settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSuitableFor(BlockState state) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
|
||||
return false;
|
||||
} else {
|
||||
return super.isSuitableFor(state);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "useOnBlock", at = @At("HEAD"), cancellable = true)
|
||||
private void disableUse(ItemUsageContext context, CallbackInfoReturnable<ActionResult> cir) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
cir.setReturnValue(ActionResult.PASS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) {
|
||||
return viaFabricPlus$effective_blocks_b1_8_1.contains(state.getBlock()) ? this.miningSpeed : 1.0F;
|
||||
} else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
|
||||
return viaFabricPlus$effective_materials_r1_16_5.contains(Material1_19_4.getMaterial(state)) ? this.miningSpeed : viaFabricPlus$effective_blocks_r1_16_5.contains(state.getBlock()) ? this.miningSpeed : 1.0F;
|
||||
} else {
|
||||
return super.getMiningSpeedMultiplier(stack, state);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -30,12 +30,12 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
@Mixin(BrushItem.class)
|
||||
public abstract class MixinBrushItem {
|
||||
|
||||
@Redirect(method = "getHitResult", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;getReachDistance(Z)F"))
|
||||
private float modifyReachDistance(boolean creative) {
|
||||
@Redirect(method = "getHitResult", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;getBlockInteractionRange()D"))
|
||||
private double modifyReachDistance(PlayerEntity instance) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_2)) {
|
||||
return 5F;
|
||||
return 5D;
|
||||
} else {
|
||||
return PlayerEntity.getReachDistance(creative);
|
||||
return instance.getBlockInteractionRange();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2024 FlorianMichael/EnZaXD <florian.michael07@gmail.com> and RK_01/RaphiMC
|
||||
* Copyright (C) 2023-2024 contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
|
||||
|
||||
import de.florianmichael.viafabricplus.injection.access.IItemStack;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Formatting;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(DrawContext.class)
|
||||
public abstract class MixinDrawContext {
|
||||
|
||||
@Redirect(method = "drawItemInSlot(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/item/ItemStack;IILjava/lang/String;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getCount()I"))
|
||||
private int handleNegativeItemCount(ItemStack instance) {
|
||||
if (((IItemStack) (Object) instance).viaFabricPlus$has1_10Tag()) {
|
||||
return ((IItemStack) (Object) instance).viaFabricPlus$get1_10Count();
|
||||
} else {
|
||||
return instance.getCount();
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "drawItemInSlot(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/item/ItemStack;IILjava/lang/String;)V", at = @At(value = "INVOKE", target = "Ljava/lang/String;valueOf(I)Ljava/lang/String;", remap = false))
|
||||
private String makeTextRed(int count) {
|
||||
if (count <= 0) {
|
||||
return Formatting.RED.toString() + count;
|
||||
} else {
|
||||
return String.valueOf(count);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2024 FlorianMichael/EnZaXD <florian.michael07@gmail.com> and RK_01/RaphiMC
|
||||
* Copyright (C) 2023-2024 contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.HoeItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.MiningToolItem;
|
||||
import net.minecraft.item.ToolMaterial;
|
||||
import net.minecraft.registry.tag.TagKey;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Mixin(HoeItem.class)
|
||||
public abstract class MixinHoeItem extends MiningToolItem {
|
||||
|
||||
@Unique
|
||||
private static final Set<Block> viaFabricPlus$effective_blocks_r1_16_5 = ImmutableSet.of(
|
||||
Blocks.NETHER_WART_BLOCK,
|
||||
Blocks.WARPED_WART_BLOCK,
|
||||
Blocks.HAY_BLOCK,
|
||||
Blocks.DRIED_KELP_BLOCK,
|
||||
Blocks.TARGET,
|
||||
Blocks.SHROOMLIGHT,
|
||||
Blocks.SPONGE,
|
||||
Blocks.WET_SPONGE,
|
||||
Blocks.JUNGLE_LEAVES,
|
||||
Blocks.OAK_LEAVES,
|
||||
Blocks.SPRUCE_LEAVES,
|
||||
Blocks.DARK_OAK_LEAVES,
|
||||
Blocks.ACACIA_LEAVES,
|
||||
Blocks.BIRCH_LEAVES
|
||||
);
|
||||
|
||||
protected MixinHoeItem(float attackDamage, float attackSpeed, ToolMaterial material, TagKey<Block> effectiveBlocks, Settings settings) {
|
||||
super(attackDamage, attackSpeed, material, effectiveBlocks, settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSuitableFor(BlockState state) {
|
||||
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_16_4) && super.isSuitableFor(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
|
||||
return 1.0F;
|
||||
} else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
|
||||
return viaFabricPlus$effective_blocks_r1_16_5.contains(state.getBlock()) ? this.miningSpeed : 1.0F;
|
||||
} else {
|
||||
return super.getMiningSpeedMultiplier(stack, state);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2024 FlorianMichael/EnZaXD <florian.michael07@gmail.com> and RK_01/RaphiMC
|
||||
* Copyright (C) 2023-2024 contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.item.ArmorItem;
|
||||
import net.minecraft.item.CrossbowItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(Item.class)
|
||||
public abstract class MixinItem {
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private int maxDamage;
|
||||
|
||||
@Shadow
|
||||
public abstract boolean isFood();
|
||||
|
||||
@Redirect(method = {"getMaxDamage", "isDamageable", "getItemBarStep", "getItemBarColor"}, at = @At(value = "FIELD", target = "Lnet/minecraft/item/Item;maxDamage:I"))
|
||||
private int changeCrossbowDamage(Item instance) {
|
||||
if (instance instanceof ArmorItem armor && ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) {
|
||||
// Counterpart in MixinArmorMaterials
|
||||
return armor.getMaterial().getDurability(armor.getType());
|
||||
} else if (instance instanceof CrossbowItem && ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_17_1)) {
|
||||
return 326;
|
||||
} else {
|
||||
return maxDamage;
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getMaxCount", at = @At("HEAD"), cancellable = true)
|
||||
private void dontStackFood(CallbackInfoReturnable<Integer> cir) {
|
||||
if (this.isFood() && ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_7tob1_7_3)) {
|
||||
cir.setReturnValue(1);
|
||||
}
|
||||
}
|
||||
|
||||
@ModifyExpressionValue(method = {"use", "finishUsing", "getUseAction", "getMaxUseTime"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;isFood()Z"))
|
||||
private boolean makeFoodInstantConsumable(boolean original) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_7tob1_7_3)) {
|
||||
return false;
|
||||
} else {
|
||||
return original;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2024 FlorianMichael/EnZaXD <florian.michael07@gmail.com> and RK_01/RaphiMC
|
||||
* Copyright (C) 2023-2024 contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.injection.access.IItemStack;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.entity.attribute.EntityAttribute;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.Slice;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(value = ItemStack.class, priority = 1)
|
||||
public abstract class MixinItemStack implements IItemStack {
|
||||
|
||||
@Shadow
|
||||
public abstract Item getItem();
|
||||
|
||||
@Unique
|
||||
private boolean viaFabricPlus$has1_10Tag;
|
||||
|
||||
@Unique
|
||||
private int viaFabricPlus$1_10Count;
|
||||
|
||||
@Redirect(method = "getTooltip",
|
||||
slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/entity/attribute/EntityAttributes;GENERIC_ATTACK_DAMAGE:Lnet/minecraft/entity/attribute/EntityAttribute;", ordinal = 0)),
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;getAttributeBaseValue(Lnet/minecraft/entity/attribute/EntityAttribute;)D", ordinal = 0))
|
||||
private double fixDamageCalculation(PlayerEntity player, EntityAttribute attribute) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
return 0;
|
||||
} else {
|
||||
return player.getAttributeBaseValue(attribute);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "copy", at = @At("RETURN"))
|
||||
private void copyViaFabricPlusData(CallbackInfoReturnable<ItemStack> cir) {
|
||||
final IItemStack mixinItemStack = (IItemStack) (Object) cir.getReturnValue();
|
||||
if (this.viaFabricPlus$has1_10Tag) {
|
||||
mixinItemStack.viaFabricPlus$set1_10Count(this.viaFabricPlus$1_10Count);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean viaFabricPlus$has1_10Tag() {
|
||||
return this.viaFabricPlus$has1_10Tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int viaFabricPlus$get1_10Count() {
|
||||
return this.viaFabricPlus$1_10Count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void viaFabricPlus$set1_10Count(final int count) {
|
||||
this.viaFabricPlus$has1_10Tag = true;
|
||||
this.viaFabricPlus$1_10Count = count;
|
||||
}
|
||||
|
||||
}
|
@ -1,100 +0,0 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2024 FlorianMichael/EnZaXD <florian.michael07@gmail.com> and RK_01/RaphiMC
|
||||
* Copyright (C) 2023-2024 contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
|
||||
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import de.florianmichael.viafabricplus.settings.impl.DebugSettings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.attribute.EntityAttribute;
|
||||
import net.minecraft.entity.attribute.EntityAttributeModifier;
|
||||
import net.minecraft.entity.attribute.EntityAttributes;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.registry.tag.TagKey;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(MiningToolItem.class)
|
||||
public abstract class MixinMiningToolItem extends ToolItem {
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private float attackDamage;
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private Multimap<EntityAttribute, EntityAttributeModifier> attributeModifiers;
|
||||
|
||||
@Unique
|
||||
private float viaFabricPlus$attackDamage_r1_8;
|
||||
|
||||
@Unique
|
||||
private Multimap<EntityAttribute, EntityAttributeModifier> viaFabricPlus$AttributeModifiers_r1_8;
|
||||
|
||||
public MixinMiningToolItem(ToolMaterial material, Settings settings) {
|
||||
super(material, settings);
|
||||
}
|
||||
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
private void init1_8Fields(float attackDamage, float attackSpeed, ToolMaterial material, TagKey<Block> effectiveBlocks, Settings settings, CallbackInfo ci) {
|
||||
final float materialAttackDamage = material.getAttackDamage();
|
||||
if ((Item) this instanceof PickaxeItem) {
|
||||
this.viaFabricPlus$attackDamage_r1_8 = 2 + materialAttackDamage;
|
||||
} else if ((Item) this instanceof ShovelItem) {
|
||||
this.viaFabricPlus$attackDamage_r1_8 = 1 + materialAttackDamage;
|
||||
} else if ((Item) this instanceof AxeItem) {
|
||||
this.viaFabricPlus$attackDamage_r1_8 = 3 + materialAttackDamage;
|
||||
} else { // HoeItem didn't use MiningToolItem abstraction in 1.8
|
||||
this.viaFabricPlus$AttributeModifiers_r1_8 = ImmutableMultimap.of();
|
||||
return;
|
||||
}
|
||||
|
||||
final ImmutableMultimap.Builder<EntityAttribute, EntityAttributeModifier> builder = ImmutableMultimap.builder();
|
||||
builder.put(EntityAttributes.GENERIC_ATTACK_DAMAGE, new EntityAttributeModifier(ATTACK_DAMAGE_MODIFIER_ID, "Tool modifier", this.viaFabricPlus$attackDamage_r1_8, EntityAttributeModifier.Operation.ADDITION));
|
||||
this.viaFabricPlus$AttributeModifiers_r1_8 = builder.build();
|
||||
}
|
||||
|
||||
@Redirect(method = "getAttackDamage", at = @At(value = "FIELD", target = "Lnet/minecraft/item/MiningToolItem;attackDamage:F"))
|
||||
private float changeAttackDamage(MiningToolItem instance) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
return this.viaFabricPlus$attackDamage_r1_8;
|
||||
} else {
|
||||
return this.attackDamage;
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "getAttributeModifiers", at = @At(value = "FIELD", target = "Lnet/minecraft/item/MiningToolItem;attributeModifiers:Lcom/google/common/collect/Multimap;"))
|
||||
private Multimap<EntityAttribute, EntityAttributeModifier> changeAttributeModifiers(MiningToolItem instance) {
|
||||
if (DebugSettings.global().replaceAttributeModifiers.isEnabled()) {
|
||||
return this.viaFabricPlus$AttributeModifiers_r1_8;
|
||||
} else {
|
||||
return this.attributeModifiers;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2024 FlorianMichael/EnZaXD <florian.michael07@gmail.com> and RK_01/RaphiMC
|
||||
* Copyright (C) 2023-2024 contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.fixes.data.Material1_19_4;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.fabricmc.yarn.constants.MiningLevels;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.MiningToolItem;
|
||||
import net.minecraft.item.PickaxeItem;
|
||||
import net.minecraft.item.ToolMaterial;
|
||||
import net.minecraft.registry.tag.TagKey;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Mixin(PickaxeItem.class)
|
||||
public abstract class MixinPickaxeItem extends MiningToolItem {
|
||||
|
||||
@Unique
|
||||
private static final Set<Block> viaFabricPlus$effective_blocks_b1_8_1 = ImmutableSet.of(Blocks.COBBLESTONE, Blocks.SMOOTH_STONE_SLAB, Blocks.SANDSTONE_SLAB, Blocks.PETRIFIED_OAK_SLAB, Blocks.COBBLESTONE_SLAB, Blocks.BRICK_SLAB, Blocks.STONE_BRICK_SLAB, Blocks.STONE, Blocks.SANDSTONE, Blocks.MOSSY_COBBLESTONE, Blocks.IRON_ORE, Blocks.IRON_BLOCK, Blocks.COAL_ORE, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE, Blocks.DIAMOND_ORE, Blocks.DIAMOND_BLOCK, Blocks.ICE, Blocks.NETHERRACK, Blocks.LAPIS_ORE, Blocks.LAPIS_BLOCK);
|
||||
|
||||
@Unique
|
||||
private static final Set<Block> viaFabricPlus$effective_blocks_r1_15_2 = ImmutableSet.of(Blocks.ACTIVATOR_RAIL, Blocks.COAL_ORE, Blocks.COBBLESTONE, Blocks.DETECTOR_RAIL, Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, Blocks.POWERED_RAIL, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE, Blocks.ICE, Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE, Blocks.MOSSY_COBBLESTONE, Blocks.NETHERRACK, Blocks.PACKED_ICE, Blocks.BLUE_ICE, Blocks.RAIL, Blocks.REDSTONE_ORE, Blocks.SANDSTONE, Blocks.CHISELED_SANDSTONE, Blocks.CUT_SANDSTONE, Blocks.CHISELED_RED_SANDSTONE, Blocks.CUT_RED_SANDSTONE, Blocks.RED_SANDSTONE, Blocks.STONE, Blocks.GRANITE, Blocks.POLISHED_GRANITE, Blocks.DIORITE, Blocks.POLISHED_DIORITE, Blocks.ANDESITE, Blocks.POLISHED_ANDESITE, Blocks.STONE_SLAB, Blocks.SMOOTH_STONE_SLAB, Blocks.SANDSTONE_SLAB, Blocks.PETRIFIED_OAK_SLAB, Blocks.COBBLESTONE_SLAB, Blocks.BRICK_SLAB, Blocks.STONE_BRICK_SLAB, Blocks.NETHER_BRICK_SLAB, Blocks.QUARTZ_SLAB, Blocks.RED_SANDSTONE_SLAB, Blocks.PURPUR_SLAB, Blocks.SMOOTH_QUARTZ, Blocks.SMOOTH_RED_SANDSTONE, Blocks.SMOOTH_SANDSTONE, Blocks.SMOOTH_STONE, Blocks.STONE_BUTTON, Blocks.STONE_PRESSURE_PLATE, Blocks.POLISHED_GRANITE_SLAB, Blocks.SMOOTH_RED_SANDSTONE_SLAB, Blocks.MOSSY_STONE_BRICK_SLAB, Blocks.POLISHED_DIORITE_SLAB, Blocks.MOSSY_COBBLESTONE_SLAB, Blocks.END_STONE_BRICK_SLAB, Blocks.SMOOTH_SANDSTONE_SLAB, Blocks.SMOOTH_QUARTZ_SLAB, Blocks.GRANITE_SLAB, Blocks.ANDESITE_SLAB, Blocks.RED_NETHER_BRICK_SLAB, Blocks.POLISHED_ANDESITE_SLAB, Blocks.DIORITE_SLAB, Blocks.SHULKER_BOX, Blocks.BLACK_SHULKER_BOX, Blocks.BLUE_SHULKER_BOX, Blocks.BROWN_SHULKER_BOX, Blocks.CYAN_SHULKER_BOX, Blocks.GRAY_SHULKER_BOX, Blocks.GREEN_SHULKER_BOX, Blocks.LIGHT_BLUE_SHULKER_BOX, Blocks.LIGHT_GRAY_SHULKER_BOX, Blocks.LIME_SHULKER_BOX, Blocks.MAGENTA_SHULKER_BOX, Blocks.ORANGE_SHULKER_BOX, Blocks.PINK_SHULKER_BOX, Blocks.PURPLE_SHULKER_BOX, Blocks.RED_SHULKER_BOX, Blocks.WHITE_SHULKER_BOX, Blocks.YELLOW_SHULKER_BOX);
|
||||
|
||||
@Unique
|
||||
private static final Set<Block> viaFabricPlus$effective_blocks_r1_16_5 = ImmutableSet.of(Blocks.ACTIVATOR_RAIL, Blocks.COAL_ORE, Blocks.COBBLESTONE, Blocks.DETECTOR_RAIL, Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, Blocks.POWERED_RAIL, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE, Blocks.NETHER_GOLD_ORE, Blocks.ICE, Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE, Blocks.MOSSY_COBBLESTONE, Blocks.NETHERRACK, Blocks.PACKED_ICE, Blocks.BLUE_ICE, Blocks.RAIL, Blocks.REDSTONE_ORE, Blocks.SANDSTONE, Blocks.CHISELED_SANDSTONE, Blocks.CUT_SANDSTONE, Blocks.CHISELED_RED_SANDSTONE, Blocks.CUT_RED_SANDSTONE, Blocks.RED_SANDSTONE, Blocks.STONE, Blocks.GRANITE, Blocks.POLISHED_GRANITE, Blocks.DIORITE, Blocks.POLISHED_DIORITE, Blocks.ANDESITE, Blocks.POLISHED_ANDESITE, Blocks.STONE_SLAB, Blocks.SMOOTH_STONE_SLAB, Blocks.SANDSTONE_SLAB, Blocks.PETRIFIED_OAK_SLAB, Blocks.COBBLESTONE_SLAB, Blocks.BRICK_SLAB, Blocks.STONE_BRICK_SLAB, Blocks.NETHER_BRICK_SLAB, Blocks.QUARTZ_SLAB, Blocks.RED_SANDSTONE_SLAB, Blocks.PURPUR_SLAB, Blocks.SMOOTH_QUARTZ, Blocks.SMOOTH_RED_SANDSTONE, Blocks.SMOOTH_SANDSTONE, Blocks.SMOOTH_STONE, Blocks.STONE_BUTTON, Blocks.STONE_PRESSURE_PLATE, Blocks.POLISHED_GRANITE_SLAB, Blocks.SMOOTH_RED_SANDSTONE_SLAB, Blocks.MOSSY_STONE_BRICK_SLAB, Blocks.POLISHED_DIORITE_SLAB, Blocks.MOSSY_COBBLESTONE_SLAB, Blocks.END_STONE_BRICK_SLAB, Blocks.SMOOTH_SANDSTONE_SLAB, Blocks.SMOOTH_QUARTZ_SLAB, Blocks.GRANITE_SLAB, Blocks.ANDESITE_SLAB, Blocks.RED_NETHER_BRICK_SLAB, Blocks.POLISHED_ANDESITE_SLAB, Blocks.DIORITE_SLAB, Blocks.SHULKER_BOX, Blocks.BLACK_SHULKER_BOX, Blocks.BLUE_SHULKER_BOX, Blocks.BROWN_SHULKER_BOX, Blocks.CYAN_SHULKER_BOX, Blocks.GRAY_SHULKER_BOX, Blocks.GREEN_SHULKER_BOX, Blocks.LIGHT_BLUE_SHULKER_BOX, Blocks.LIGHT_GRAY_SHULKER_BOX, Blocks.LIME_SHULKER_BOX, Blocks.MAGENTA_SHULKER_BOX, Blocks.ORANGE_SHULKER_BOX, Blocks.PINK_SHULKER_BOX, Blocks.PURPLE_SHULKER_BOX, Blocks.RED_SHULKER_BOX, Blocks.WHITE_SHULKER_BOX, Blocks.YELLOW_SHULKER_BOX, Blocks.PISTON, Blocks.STICKY_PISTON, Blocks.PISTON_HEAD);
|
||||
|
||||
@Unique
|
||||
private static final Set<Material1_19_4> viaFabricPlus$effective_materials_r1_16_5 = ImmutableSet.of(Material1_19_4.METAL, Material1_19_4.REPAIR_STATION, Material1_19_4.STONE);
|
||||
|
||||
protected MixinPickaxeItem(float attackDamage, float attackSpeed, ToolMaterial material, TagKey<Block> effectiveBlocks, Settings settings) {
|
||||
super(attackDamage, attackSpeed, material, effectiveBlocks, settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSuitableFor(BlockState state) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
|
||||
final int miningLevel = this.getMaterial().getMiningLevel();
|
||||
if (state.isOf(Blocks.OBSIDIAN) || state.isOf(Blocks.CRYING_OBSIDIAN) || state.isOf(Blocks.NETHERITE_BLOCK) || state.isOf(Blocks.RESPAWN_ANCHOR) || state.isOf(Blocks.ANCIENT_DEBRIS)) {
|
||||
return miningLevel >= MiningLevels.DIAMOND;
|
||||
} else if (state.isOf(Blocks.DIAMOND_BLOCK) || state.isOf(Blocks.DIAMOND_ORE) || state.isOf(Blocks.EMERALD_ORE) || state.isOf(Blocks.EMERALD_BLOCK) || state.isOf(Blocks.GOLD_BLOCK) || state.isOf(Blocks.GOLD_ORE) || state.isOf(Blocks.REDSTONE_ORE)) {
|
||||
return miningLevel >= MiningLevels.IRON;
|
||||
} else if (state.isOf(Blocks.IRON_BLOCK) || state.isOf(Blocks.IRON_ORE) || state.isOf(Blocks.LAPIS_BLOCK) || state.isOf(Blocks.LAPIS_ORE)) {
|
||||
return miningLevel >= MiningLevels.STONE;
|
||||
} else {
|
||||
return viaFabricPlus$effective_materials_r1_16_5.contains(Material1_19_4.getMaterial(state)) || state.isOf(Blocks.NETHER_GOLD_ORE);
|
||||
}
|
||||
} else {
|
||||
return super.isSuitableFor(state);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) {
|
||||
return viaFabricPlus$effective_blocks_b1_8_1.contains(state.getBlock()) ? this.miningSpeed : 1.0F;
|
||||
} else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
|
||||
return viaFabricPlus$effective_materials_r1_16_5.contains(Material1_19_4.getMaterial(state)) ? this.miningSpeed : viaFabricPlus$effective_blocks_r1_15_2.contains(state.getBlock()) ? this.miningSpeed : 1.0F;
|
||||
} else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
|
||||
return viaFabricPlus$effective_materials_r1_16_5.contains(Material1_19_4.getMaterial(state)) ? this.miningSpeed : viaFabricPlus$effective_blocks_r1_16_5.contains(state.getBlock()) ? this.miningSpeed : 1.0F;
|
||||
}
|
||||
|
||||
return super.getMiningSpeedMultiplier(stack, state);
|
||||
}
|
||||
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2024 FlorianMichael/EnZaXD <florian.michael07@gmail.com> and RK_01/RaphiMC
|
||||
* Copyright (C) 2023-2024 contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ShearsItem;
|
||||
import net.minecraft.registry.tag.BlockTags;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(ShearsItem.class)
|
||||
public abstract class MixinShearsItem extends Item {
|
||||
|
||||
public MixinShearsItem(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Inject(method = "getMiningSpeedMultiplier", at = @At("HEAD"), cancellable = true)
|
||||
private void changeMiningSpeed(ItemStack stack, BlockState state, CallbackInfoReturnable<Float> cir) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
|
||||
if (!state.isOf(Blocks.COBWEB) && !state.isIn(BlockTags.LEAVES)) {
|
||||
cir.setReturnValue(state.isIn(BlockTags.WOOL) ? 5.0F : super.getMiningSpeedMultiplier(stack, state));
|
||||
} else {
|
||||
cir.setReturnValue(15.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "isSuitableFor", at = @At("HEAD"), cancellable = true)
|
||||
private void changeEffectiveBlocks(BlockState state, CallbackInfoReturnable<Boolean> cir) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) {
|
||||
cir.setReturnValue(state.isOf(Blocks.COBWEB));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,82 +0,0 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2024 FlorianMichael/EnZaXD <florian.michael07@gmail.com> and RK_01/RaphiMC
|
||||
* Copyright (C) 2023-2024 contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.registry.tag.TagKey;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.Slice;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@Mixin(ShovelItem.class)
|
||||
public abstract class MixinShovelItem extends MiningToolItem {
|
||||
|
||||
@Unique
|
||||
private static final Set<Block> viaFabricPlus$effective_blocks_b1_8_1 = ImmutableSet.of(Blocks.GRASS_BLOCK, Blocks.DIRT, Blocks.SAND, Blocks.GRAVEL, Blocks.SNOW, Blocks.SNOW_BLOCK, Blocks.CLAY, Blocks.FARMLAND);
|
||||
|
||||
@Unique
|
||||
private static final Set<Block> viaFabricPlus$effective_blocks_r1_16_5 = ImmutableSet.of(Blocks.CLAY, Blocks.DIRT, Blocks.COARSE_DIRT, Blocks.PODZOL, Blocks.FARMLAND, Blocks.GRASS_BLOCK, Blocks.GRAVEL, Blocks.MYCELIUM, Blocks.SAND, Blocks.RED_SAND, Blocks.SNOW_BLOCK, Blocks.SNOW, Blocks.SOUL_SAND, Blocks.DIRT_PATH, Blocks.WHITE_CONCRETE_POWDER, Blocks.ORANGE_CONCRETE_POWDER, Blocks.MAGENTA_CONCRETE_POWDER, Blocks.LIGHT_BLUE_CONCRETE_POWDER, Blocks.YELLOW_CONCRETE_POWDER, Blocks.LIME_CONCRETE_POWDER, Blocks.PINK_CONCRETE_POWDER, Blocks.GRAY_CONCRETE_POWDER, Blocks.LIGHT_GRAY_CONCRETE_POWDER, Blocks.CYAN_CONCRETE_POWDER, Blocks.PURPLE_CONCRETE_POWDER, Blocks.BLUE_CONCRETE_POWDER, Blocks.BROWN_CONCRETE_POWDER, Blocks.GREEN_CONCRETE_POWDER, Blocks.RED_CONCRETE_POWDER, Blocks.BLACK_CONCRETE_POWDER, Blocks.SOUL_SOIL);
|
||||
|
||||
protected MixinShovelItem(float attackDamage, float attackSpeed, ToolMaterial material, TagKey<Block> effectiveBlocks, Item.Settings settings) {
|
||||
super(attackDamage, attackSpeed, material, effectiveBlocks, settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSuitableFor(BlockState state) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
|
||||
return state.isOf(Blocks.SNOW) || state.isOf(Blocks.SNOW_BLOCK);
|
||||
} else {
|
||||
return super.isSuitableFor(state);
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "useOnBlock", slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/item/ShovelItem;PATH_STATES:Ljava/util/Map;")), at = @At(value = "INVOKE", target = "Ljava/util/Map;get(Ljava/lang/Object;)Ljava/lang/Object;", ordinal = 0, remap = false))
|
||||
private Object disablePathAction(Map<Object, Object> instance, Object grassBlock) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
return null;
|
||||
} else {
|
||||
return instance.get(grassBlock);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) {
|
||||
return viaFabricPlus$effective_blocks_b1_8_1.contains(state.getBlock()) ? this.miningSpeed : 1.0F;
|
||||
} else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_16_4)) {
|
||||
return viaFabricPlus$effective_blocks_r1_16_5.contains(state.getBlock()) ? this.miningSpeed : 1.0F;
|
||||
}
|
||||
|
||||
return super.getMiningSpeedMultiplier(stack, state);
|
||||
}
|
||||
|
||||
}
|
@ -1,135 +0,0 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2024 FlorianMichael/EnZaXD <florian.michael07@gmail.com> and RK_01/RaphiMC
|
||||
* Copyright (C) 2023-2024 contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
|
||||
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import de.florianmichael.viafabricplus.settings.impl.DebugSettings;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.attribute.EntityAttribute;
|
||||
import net.minecraft.entity.attribute.EntityAttributeModifier;
|
||||
import net.minecraft.entity.attribute.EntityAttributes;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.SwordItem;
|
||||
import net.minecraft.item.ToolItem;
|
||||
import net.minecraft.item.ToolMaterial;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.util.UseAction;
|
||||
import net.minecraft.world.World;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(SwordItem.class)
|
||||
public abstract class MixinSwordItem extends ToolItem {
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private float attackDamage;
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private Multimap<EntityAttribute, EntityAttributeModifier> attributeModifiers;
|
||||
|
||||
@Unique
|
||||
private float viaFabricPlus$attackDamage_r1_8;
|
||||
|
||||
@Unique
|
||||
private Multimap<EntityAttribute, EntityAttributeModifier> viaFabricPlus$AttributeModifiers_r1_8;
|
||||
|
||||
public MixinSwordItem(ToolMaterial material, Settings settings) {
|
||||
super(material, settings);
|
||||
}
|
||||
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
private void init1_8Fields(ToolMaterial toolMaterial, int attackDamage, float attackSpeed, Settings settings, CallbackInfo ci) {
|
||||
this.viaFabricPlus$attackDamage_r1_8 = 4 + toolMaterial.getAttackDamage();
|
||||
final ImmutableMultimap.Builder<EntityAttribute, EntityAttributeModifier> builder = ImmutableMultimap.builder();
|
||||
builder.put(EntityAttributes.GENERIC_ATTACK_DAMAGE, new EntityAttributeModifier(ATTACK_DAMAGE_MODIFIER_ID, "Weapon modifier", this.viaFabricPlus$attackDamage_r1_8, EntityAttributeModifier.Operation.ADDITION));
|
||||
this.viaFabricPlus$AttributeModifiers_r1_8 = builder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
|
||||
if (ProtocolTranslator.getTargetVersion().betweenInclusive(LegacyProtocolVersion.b1_8tob1_8_1, ProtocolVersion.v1_8)) {
|
||||
ItemStack itemStack = user.getStackInHand(hand);
|
||||
user.setCurrentHand(hand);
|
||||
return TypedActionResult.consume(itemStack);
|
||||
} else {
|
||||
return super.use(world, user, hand);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public UseAction getUseAction(ItemStack stack) {
|
||||
if (ProtocolTranslator.getTargetVersion().betweenInclusive(LegacyProtocolVersion.b1_8tob1_8_1, ProtocolVersion.v1_8)) {
|
||||
return UseAction.BLOCK;
|
||||
} else {
|
||||
return super.getUseAction(stack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxUseTime(ItemStack stack) {
|
||||
if (ProtocolTranslator.getTargetVersion().betweenInclusive(LegacyProtocolVersion.b1_8tob1_8_1, ProtocolVersion.v1_8)) {
|
||||
return 72000;
|
||||
} else {
|
||||
return super.getMaxUseTime(stack);
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "getAttackDamage", at = @At(value = "FIELD", target = "Lnet/minecraft/item/SwordItem;attackDamage:F"))
|
||||
private float changeAttackDamage(SwordItem instance) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
return this.viaFabricPlus$attackDamage_r1_8;
|
||||
} else {
|
||||
return this.attackDamage;
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "getAttributeModifiers", at = @At(value = "FIELD", target = "Lnet/minecraft/item/SwordItem;attributeModifiers:Lcom/google/common/collect/Multimap;"))
|
||||
private Multimap<EntityAttribute, EntityAttributeModifier> changeAttributeModifiers(SwordItem instance) {
|
||||
if (DebugSettings.global().replaceAttributeModifiers.isEnabled()) {
|
||||
return this.viaFabricPlus$AttributeModifiers_r1_8;
|
||||
} else {
|
||||
return this.attributeModifiers;
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getMiningSpeedMultiplier", at = @At("HEAD"), cancellable = true)
|
||||
private void changeMiningSpeed(ItemStack stack, BlockState state, CallbackInfoReturnable<Float> cir) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_8tob1_8_1)) {
|
||||
cir.setReturnValue(state.isOf(Blocks.COBWEB) ? 15.0F : 1.5F);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -21,11 +21,8 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.network;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.storage.InventoryAcknowledgements;
|
||||
import de.florianmichael.viafabricplus.fixes.ClientsideFixes;
|
||||
import de.florianmichael.viafabricplus.injection.access.IClientConnection;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.fabricmc.fabric.impl.networking.payload.ResolvablePayload;
|
||||
import net.fabricmc.fabric.impl.networking.payload.UntypedPayload;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.ClientCommonNetworkHandler;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
@ -49,7 +46,6 @@ import java.net.URL;
|
||||
import java.time.Duration;
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
@SuppressWarnings("UnstableApiUsage")
|
||||
@Mixin(value = ClientCommonNetworkHandler.class, priority = 1 /* Has to be applied before Fabric's Networking API, so it doesn't cancel our custom-payload packets */)
|
||||
public abstract class MixinClientCommonNetworkHandler {
|
||||
|
||||
@ -104,10 +100,11 @@ public abstract class MixinClientCommonNetworkHandler {
|
||||
|
||||
@Inject(method = "onCustomPayload(Lnet/minecraft/network/packet/s2c/common/CustomPayloadS2CPacket;)V", at = @At("HEAD"), cancellable = true)
|
||||
private void handleSyncTask(CustomPayloadS2CPacket packet, CallbackInfo ci) {
|
||||
if (packet.payload().id().toString().equals(ClientsideFixes.PACKET_SYNC_IDENTIFIER) && packet.payload() instanceof ResolvablePayload payload) {
|
||||
// TODO: Update: Fix
|
||||
/*if (packet.payload().id().toString().equals(ClientsideFixes.PACKET_SYNC_IDENTIFIER) && packet.payload() instanceof ResolvablePayload payload) {
|
||||
ClientsideFixes.handleSyncTask(((UntypedPayload) payload.resolve(null)).buffer());
|
||||
ci.cancel(); // Cancel the packet, so it doesn't get processed by the client
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Inject(method = "onResourcePackSend", at = @At("HEAD"), cancellable = true)
|
||||
|
@ -28,6 +28,7 @@ import de.florianmichael.viafabricplus.injection.access.IDownloadingTerrainScree
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import de.florianmichael.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.DownloadingTerrainScreen;
|
||||
import net.minecraft.client.network.*;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.entity.Entity;
|
||||
@ -81,8 +82,8 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH
|
||||
super(client, connection, connectionState);
|
||||
}
|
||||
|
||||
@WrapWithCondition(method = "onPlayerRespawn", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;startWorldLoading(Lnet/minecraft/client/network/ClientPlayerEntity;Lnet/minecraft/client/world/ClientWorld;)V"))
|
||||
private boolean checkDimensionChange(ClientPlayNetworkHandler instance, ClientPlayerEntity player, ClientWorld world, @Local RegistryKey<World> registryKey) {
|
||||
@WrapWithCondition(method = "onPlayerRespawn", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;startWorldLoading(Lnet/minecraft/client/network/ClientPlayerEntity;Lnet/minecraft/client/world/ClientWorld;Lnet/minecraft/client/gui/screen/DownloadingTerrainScreen$WorldEntryReason;)V"))
|
||||
private boolean checkDimensionChange(ClientPlayNetworkHandler instance, ClientPlayerEntity player, ClientWorld world, DownloadingTerrainScreen.WorldEntryReason worldEntryReason, @Local(ordinal = 0) RegistryKey<World> registryKey) {
|
||||
return ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_20_3) || registryKey != this.client.player.getWorld().getRegistryKey();
|
||||
}
|
||||
|
||||
@ -124,7 +125,7 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "onServerMetadata", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;isSecureChatEnforced()Z"))
|
||||
@Redirect(method = "onGameJoin", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;isSecureChatEnforced()Z"))
|
||||
private boolean removeSecureChatWarning(ClientPlayNetworkHandler instance) {
|
||||
return isSecureChatEnforced() || VisualSettings.global().disableSecureChatWarning.isEnabled();
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ public abstract class MixinClientPlayerInteractionManager implements IClientPlay
|
||||
}
|
||||
|
||||
@Redirect(method = {"method_41936", "method_41935"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;breakBlock(Lnet/minecraft/util/math/BlockPos;)Z"))
|
||||
private boolean checkFireBlock(ClientPlayerInteractionManager instance, BlockPos pos, @Local Direction direction) {
|
||||
private boolean checkFireBlock(ClientPlayerInteractionManager instance, BlockPos pos, @Local(argsOnly = true) Direction direction) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
|
||||
return !this.viaFabricPlus$extinguishFire(pos, direction) && instance.breakBlock(pos);
|
||||
} else {
|
||||
|
@ -1,88 +0,0 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2024 FlorianMichael/EnZaXD <florian.michael07@gmail.com> and RK_01/RaphiMC
|
||||
* Copyright (C) 2023-2024 contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.network;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.network.packet.BrandCustomPayload;
|
||||
import net.minecraft.network.packet.CustomPayload;
|
||||
import net.minecraft.network.packet.s2c.common.CustomPayloadS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.custom.DebugGameTestAddMarkerCustomPayload;
|
||||
import net.minecraft.network.packet.s2c.custom.DebugGameTestClearCustomPayload;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Mixin(CustomPayloadS2CPacket.class)
|
||||
public abstract class MixinCustomPayloadS2CPacket {
|
||||
|
||||
@Unique
|
||||
private static final Map<Identifier, ProtocolVersion> viaFabricPlus$PAYLOAD_DIFF = ImmutableMap.<Identifier, ProtocolVersion>builder()
|
||||
.put(BrandCustomPayload.ID, LegacyProtocolVersion.c0_0_15a_1)
|
||||
.put(DebugGameTestAddMarkerCustomPayload.ID, ProtocolVersion.v1_14)
|
||||
.put(DebugGameTestClearCustomPayload.ID, ProtocolVersion.v1_14)
|
||||
.build();
|
||||
|
||||
@Redirect(method = "readPayload", at = @At(value = "INVOKE", target = "Ljava/util/Map;get(Ljava/lang/Object;)Ljava/lang/Object;", remap = false))
|
||||
private static Object filterAllowedCustomPayloads(Map<Identifier, PacketByteBuf.PacketReader<? extends CustomPayload>> instance, Object object) {
|
||||
final Identifier identifier = (Identifier) object;
|
||||
if (instance.containsKey(identifier)) {
|
||||
final PacketByteBuf.PacketReader<? extends CustomPayload> reader = instance.get(identifier);
|
||||
|
||||
// Mods might add custom payloads that we don't want to filter, so we check for the namespace.
|
||||
// Mods should NEVER use the default namespace of the game, not only to not break this code,
|
||||
// but also to not break other mods and the game itself.
|
||||
if (!identifier.getNamespace().equals(Identifier.DEFAULT_NAMESPACE)) {
|
||||
return reader;
|
||||
}
|
||||
|
||||
// Technically it's wrong to just drop all payloads, but ViaVersion doesn't translate them and the server can't detect if
|
||||
// we handled the payload or not, so dropping them is easier than adding a bunch of useless translations for payloads
|
||||
// which doesn't do anything on the client anyway.
|
||||
if (!viaFabricPlus$PAYLOAD_DIFF.containsKey(identifier) || ProtocolTranslator.getTargetVersion().olderThan(viaFabricPlus$PAYLOAD_DIFF.get(identifier))) {
|
||||
return null;
|
||||
}
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20)) {
|
||||
// Skip remaining bytes after reading the payload and return null if the payload fails to read
|
||||
return (PacketByteBuf.PacketReader<? extends CustomPayload>) packetByteBuf -> {
|
||||
try {
|
||||
final CustomPayload result = reader.apply(packetByteBuf);
|
||||
packetByteBuf.skipBytes(packetByteBuf.readableBytes());
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
} else {
|
||||
return reader;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2024 FlorianMichael/EnZaXD <florian.michael07@gmail.com> and RK_01/RaphiMC
|
||||
* Copyright (C) 2023-2024 contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.network;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.fixes.ClientsideFixes;
|
||||
import de.florianmichael.viafabricplus.injection.access.IItemStack;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtElement;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(value = PacketByteBuf.class)
|
||||
public abstract class MixinPacketByteBuf {
|
||||
|
||||
@Redirect(method = "readItemStack", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;setNbt(Lnet/minecraft/nbt/NbtCompound;)V"))
|
||||
private void removeViaFabricPlusTag(ItemStack instance, NbtCompound tag) {
|
||||
if (tag != null && tag.contains(ClientsideFixes.ITEM_COUNT_NBT_TAG, NbtElement.BYTE_TYPE) && ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_10)) {
|
||||
final IItemStack mixinItemStack = ((IItemStack) (Object) instance);
|
||||
mixinItemStack.viaFabricPlus$set1_10Count(tag.getByte(ClientsideFixes.ITEM_COUNT_NBT_TAG));
|
||||
tag.remove(ClientsideFixes.ITEM_COUNT_NBT_TAG);
|
||||
if (tag.isEmpty()) tag = null;
|
||||
}
|
||||
|
||||
instance.setNbt(tag);
|
||||
}
|
||||
|
||||
@Redirect(method = "writeItemStack", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getNbt()Lnet/minecraft/nbt/NbtCompound;"))
|
||||
private NbtCompound addViaFabricPlusTag(ItemStack instance) {
|
||||
NbtCompound tag = instance.getNbt();
|
||||
|
||||
final IItemStack mixinItemStack = ((IItemStack) (Object) instance);
|
||||
if (mixinItemStack.viaFabricPlus$has1_10Tag()) {
|
||||
if (tag == null) tag = new NbtCompound();
|
||||
tag.putByte(ClientsideFixes.ITEM_COUNT_NBT_TAG, (byte) mixinItemStack.viaFabricPlus$get1_10Count());
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
}
|
@ -31,9 +31,6 @@ import net.minecraft.client.option.GameOptions;
|
||||
import net.minecraft.text.Text;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(MouseOptionsScreen.class)
|
||||
public abstract class MixinMouseOptionsScreen extends GameOptionsScreen {
|
||||
@ -45,10 +42,11 @@ public abstract class MixinMouseOptionsScreen extends GameOptionsScreen {
|
||||
super(parent, gameOptions, title);
|
||||
}
|
||||
|
||||
@Inject(method = "render", at = @At("RETURN"))
|
||||
private void render1_13SliderValue(DrawContext drawContext, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||
@Override
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2) && this.buttonList.getWidgetFor(this.gameOptions.getMouseSensitivity()).isHovered()) {
|
||||
drawContext.drawTooltip(textRenderer, Text.of("<=1.13.2 Sensitivity: " + MathUtil.get1_13SliderValue(this.gameOptions.getMouseSensitivity().getValue().floatValue()).valueInt() + "%"), mouseX, mouseY);
|
||||
context.drawTooltip(textRenderer, Text.of("<=1.13.2 Sensitivity: " + MathUtil.get1_13SliderValue(this.gameOptions.getMouseSensitivity().getValue().floatValue()).valueInt() + "%"), mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2024 FlorianMichael/EnZaXD <florian.michael07@gmail.com> and RK_01/RaphiMC
|
||||
* Copyright (C) 2023-2024 contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen;
|
||||
|
||||
import de.florianmichael.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.option.OptionsScreen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.client.gui.widget.GridWidget;
|
||||
import net.minecraft.text.Text;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
@Mixin(OptionsScreen.class)
|
||||
public abstract class MixinOptionsScreen extends Screen {
|
||||
|
||||
protected MixinOptionsScreen(Text title) {
|
||||
super(title);
|
||||
}
|
||||
|
||||
@Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/GridWidget$Adder;add(Lnet/minecraft/client/gui/widget/Widget;)Lnet/minecraft/client/gui/widget/Widget;", ordinal = 10, shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
private void showSuperSecretSettings(CallbackInfo ci, GridWidget gridWidget, GridWidget.Adder adder) {
|
||||
if (VisualSettings.global().showSuperSecretSettings.isEnabled() && MinecraftClient.getInstance().player != null) {
|
||||
this.addDrawableChild(ButtonWidget.builder(Text.literal("Super Secret Settings..."), button -> MinecraftClient.getInstance().gameRenderer.cycleSuperSecretSetting()).dimensions(this.width / 2 + 5, this.height / 6 + 18, 150, 20).build());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -21,10 +21,10 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.text.Style;
|
||||
import net.minecraft.util.StringHelper;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
@ -42,7 +42,7 @@ public abstract class MixinScreen {
|
||||
@Inject(method = "handleTextClick", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;error(Ljava/lang/String;Ljava/lang/Object;)V", shift = At.Shift.BEFORE, ordinal = 1, remap = false), cancellable = true)
|
||||
private void allowRunCommandAction(Style style, CallbackInfoReturnable<Boolean> cir) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19)) {
|
||||
this.client.player.networkHandler.sendChatMessage(SharedConstants.stripInvalidChars(style.getClickEvent().getValue()));
|
||||
this.client.player.networkHandler.sendChatMessage(StringHelper.stripInvalidChars(style.getClickEvent().getValue()));
|
||||
cir.setReturnValue(true);
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||
@Mixin(ChatHud.class)
|
||||
public abstract class MixinChatHud {
|
||||
|
||||
@ModifyVariable(method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;ILnet/minecraft/client/gui/hud/MessageIndicator;Z)V", at = @At("HEAD"), ordinal = 0, argsOnly = true)
|
||||
@ModifyVariable(method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;Lnet/minecraft/client/gui/hud/MessageIndicator;)V", at = @At("HEAD"), ordinal = 0, argsOnly = true)
|
||||
private MessageIndicator removeIndicator(MessageIndicator instance) {
|
||||
return VisualSettings.global().hideSignatureIndicator.isEnabled() ? null : instance;
|
||||
}
|
||||
|
@ -1,106 +0,0 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2024 FlorianMichael/EnZaXD <florian.michael07@gmail.com> and RK_01/RaphiMC
|
||||
* Copyright (C) 2023-2024 contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.screen.hud;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||
import de.florianmichael.viafabricplus.settings.impl.VisualSettings;
|
||||
import net.minecraft.client.gui.hud.InGameHud;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
import org.spongepowered.asm.mixin.injection.Slice;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(InGameHud.class)
|
||||
public abstract class MixinInGameHud {
|
||||
|
||||
@Shadow
|
||||
private int scaledWidth;
|
||||
|
||||
// Removing newer elements
|
||||
|
||||
@Inject(method = {"renderMountJumpBar", "renderMountHealth"}, at = @At("HEAD"), cancellable = true)
|
||||
private void removeMountJumpBar(CallbackInfo ci) {
|
||||
if (VisualSettings.global().removeNewerHudElements.isEnabled()) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getHeartCount", at = @At("HEAD"), cancellable = true)
|
||||
private void removeHungerBar(LivingEntity entity, CallbackInfoReturnable<Integer> cir) {
|
||||
if (VisualSettings.global().removeNewerHudElements.isEnabled()) {
|
||||
cir.setReturnValue(1);
|
||||
}
|
||||
}
|
||||
|
||||
// Moving down all remaining elements
|
||||
|
||||
@ModifyExpressionValue(method = "renderStatusBars", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/hud/InGameHud;scaledHeight:I", opcode = Opcodes.GETFIELD),
|
||||
require = 0)
|
||||
private int moveHealthDown(int originalValue) {
|
||||
if (VisualSettings.global().removeNewerHudElements.isEnabled()) {
|
||||
return originalValue + 6;
|
||||
} else {
|
||||
return originalValue;
|
||||
}
|
||||
}
|
||||
|
||||
@ModifyArg(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Lnet/minecraft/util/Identifier;IIII)V"), slice = @Slice(
|
||||
from = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;push(Ljava/lang/String;)V"),
|
||||
to = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", ordinal = 0)), index = 1,
|
||||
require = 0)
|
||||
private int moveArmorNextToHealth(int oldX) {
|
||||
if (VisualSettings.global().removeNewerHudElements.isEnabled()) {
|
||||
return scaledWidth - oldX - 9;
|
||||
} else {
|
||||
return oldX;
|
||||
}
|
||||
}
|
||||
|
||||
@ModifyArg(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Lnet/minecraft/util/Identifier;IIII)V"), slice = @Slice(
|
||||
from = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;push(Ljava/lang/String;)V"),
|
||||
to = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", ordinal = 1)), index = 2,
|
||||
require = 0)
|
||||
private int moveArmorDown(int oldY) {
|
||||
if (VisualSettings.global().removeNewerHudElements.isEnabled()) {
|
||||
return oldY + 9;
|
||||
} else {
|
||||
return oldY;
|
||||
}
|
||||
}
|
||||
|
||||
@ModifyArg(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawGuiTexture(Lnet/minecraft/util/Identifier;IIII)V"), slice = @Slice(
|
||||
from = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", ordinal = 2),
|
||||
to = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;pop()V")), index = 1,
|
||||
require = 0)
|
||||
private int moveAir(int oldY) {
|
||||
if (VisualSettings.global().removeNewerHudElements.isEnabled()) {
|
||||
return scaledWidth - oldY - 9;
|
||||
} else {
|
||||
return oldY;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -31,7 +31,9 @@ import net.minecraft.screen.ScreenHandlerType;
|
||||
import net.minecraft.screen.slot.Slot;
|
||||
import net.minecraft.screen.slot.SlotActionType;
|
||||
import net.minecraft.village.MerchantInventory;
|
||||
import net.minecraft.village.TradeOffer;
|
||||
import net.minecraft.village.TradeOfferList;
|
||||
import net.minecraft.village.TradedItem;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@ -82,8 +84,9 @@ public abstract class MixinMerchantScreenHandler extends ScreenHandler {
|
||||
|
||||
// refill the slots
|
||||
if (this.merchantInventory.getStack(0).isEmpty() && this.merchantInventory.getStack(1).isEmpty()) {
|
||||
this.viaFabricPlus$autofill(interactionManager, player, 0, this.getRecipes().get(recipeId).getAdjustedFirstBuyItem());
|
||||
this.viaFabricPlus$autofill(interactionManager, player, 1, this.getRecipes().get(recipeId).getSecondBuyItem());
|
||||
final TradeOffer tradeOffer = this.getRecipes().get(recipeId);
|
||||
this.viaFabricPlus$autofill(interactionManager, player, 0, tradeOffer.getFirstBuyItem());
|
||||
tradeOffer.getSecondBuyItem().ifPresent(item -> this.viaFabricPlus$autofill(interactionManager, player, 1, item));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -96,16 +99,17 @@ public abstract class MixinMerchantScreenHandler extends ScreenHandler {
|
||||
}
|
||||
|
||||
@Unique
|
||||
private void viaFabricPlus$autofill(ClientPlayerInteractionManager interactionManager, ClientPlayerEntity player, int inputSlot, ItemStack stackNeeded) {
|
||||
if (stackNeeded.isEmpty()) return;
|
||||
|
||||
private void viaFabricPlus$autofill(ClientPlayerInteractionManager interactionManager, ClientPlayerEntity player, int inputSlot, TradedItem stackNeeded) {
|
||||
int slot;
|
||||
for (slot = 3; slot < 39; slot++) {
|
||||
final ItemStack stack = slots.get(slot).getStack();
|
||||
if (ItemStack.canCombine(stack, stackNeeded)) {
|
||||
final ItemStack itemStack = this.slots.get(slot).getStack();
|
||||
if (!itemStack.isEmpty() && stackNeeded.matches(itemStack)) {
|
||||
final ItemStack itemStack2 = this.merchantInventory.getStack(slot);
|
||||
if (ItemStack.areItemsAndComponentsEqual(itemStack, itemStack2)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (slot == 39) return;
|
||||
|
||||
final boolean wasHoldingItem = !player.currentScreenHandler.getCursorStack().isEmpty();
|
||||
|
@ -31,6 +31,7 @@ import net.minecraft.client.gui.screen.ingame.GenericContainerScreen;
|
||||
import net.minecraft.inventory.SimpleInventory;
|
||||
import net.minecraft.screen.GenericContainerScreenHandler;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TextCodecs;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@ -52,11 +53,11 @@ public abstract class MixinInventoryPackets {
|
||||
try {
|
||||
final int syncId = data.readUnsignedByte();
|
||||
final int size = data.readUnsignedByte();
|
||||
final Text title1_20 = data.readText();
|
||||
final Text mcTitle = TextCodecs.UNLIMITED_REGISTRY_PACKET_CODEC.decode(data);
|
||||
|
||||
final GenericContainerScreenHandler screenHandler = new GenericContainerScreenHandler(null, syncId, mc.player.getInventory(), new SimpleInventory(size), MathHelper.ceil(size / 9F));
|
||||
mc.player.currentScreenHandler = screenHandler;
|
||||
mc.setScreen(new GenericContainerScreen(screenHandler, mc.player.getInventory(), title1_20));
|
||||
mc.setScreen(new GenericContainerScreen(screenHandler, mc.player.getInventory(), mcTitle));
|
||||
} catch (Throwable t) {
|
||||
throw new RuntimeException("Failed to handle OpenWindow packet data", t);
|
||||
}
|
||||
|
@ -48,7 +48,6 @@ public abstract class MixinProtocolVersion {
|
||||
viaFabricPlus$remaps.put("1.19.1/1.19.2", new Pair<>("1.19.1-1.19.2", null));
|
||||
viaFabricPlus$remaps.put("1.20/1.20.1", new Pair<>("1.20-1.20.1", null));
|
||||
viaFabricPlus$remaps.put("1.20.3/1.20.4", new Pair<>("1.20.3-1.20.4", null));
|
||||
viaFabricPlus$remaps.put("1.20.5", new Pair<>("24w09a", null));
|
||||
}
|
||||
|
||||
@Redirect(method = "<clinit>", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;register(ILjava/lang/String;)Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;"))
|
||||
|
@ -85,7 +85,7 @@ public class ProtocolTranslator {
|
||||
/**
|
||||
* The native version of the client
|
||||
*/
|
||||
public static final ProtocolVersion NATIVE_VERSION = ProtocolVersion.v1_20_3;
|
||||
public static final ProtocolVersion NATIVE_VERSION = ProtocolVersion.v1_20_5;
|
||||
|
||||
/**
|
||||
* Protocol version that is used to enable protocol auto-detect
|
||||
@ -234,7 +234,7 @@ public class ProtocolTranslator {
|
||||
public static UserConnection getPlayNetworkUserConnection() {
|
||||
final ClientPlayNetworkHandler handler = MinecraftClient.getInstance().getNetworkHandler();
|
||||
if (handler == null) {
|
||||
throw new IllegalStateException("The player is not connected to a server");
|
||||
return null;
|
||||
}
|
||||
|
||||
return ((IClientConnection) handler.getConnection()).viaFabricPlus$getUserConnection();
|
||||
|
@ -20,15 +20,8 @@
|
||||
package de.florianmichael.viafabricplus.protocoltranslator.impl.provider.viabedrock;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import de.florianmichael.viafabricplus.settings.impl.BedrockSettings;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.ConfirmScreen;
|
||||
import net.minecraft.client.gui.screen.TitleScreen;
|
||||
import net.minecraft.client.gui.screen.multiplayer.ConnectScreen;
|
||||
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
|
||||
import net.minecraft.client.network.ServerAddress;
|
||||
import net.minecraft.client.network.ServerInfo;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.network.packet.s2c.common.ServerTransferS2CPacket;
|
||||
import net.raphimc.viabedrock.protocol.providers.TransferProvider;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
@ -37,31 +30,7 @@ public class ViaFabricPlusTransferProvider extends TransferProvider {
|
||||
|
||||
@Override
|
||||
public void connectToServer(UserConnection user, InetSocketAddress newAddress) {
|
||||
final var mc = MinecraftClient.getInstance();
|
||||
mc.execute(() -> {
|
||||
if (BedrockSettings.global().openPromptGUIToConfirmTransfer.getValue()) {
|
||||
mc.setScreen(new ConfirmScreen((bl) -> {
|
||||
if (bl) {
|
||||
connect(newAddress);
|
||||
} else {
|
||||
mc.setScreen(null);
|
||||
}
|
||||
},
|
||||
Text.of("ViaFabricPlus"),
|
||||
Text.translatable("bedrock.viafabricplus.confirm_transfer_server_prompt", newAddress.getHostName() + ":" + newAddress.getPort())
|
||||
));
|
||||
} else {
|
||||
connect(newAddress);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void connect(final InetSocketAddress newAddress) {
|
||||
final var mc = MinecraftClient.getInstance();
|
||||
mc.world.disconnect();
|
||||
|
||||
final var serverInfo = new ServerInfo(newAddress.getHostName(), newAddress.getHostName() + ":" + newAddress.getPort(), ServerInfo.ServerType.OTHER);
|
||||
ConnectScreen.connect(new MultiplayerScreen(new TitleScreen()), mc, ServerAddress.parse(serverInfo.address), serverInfo, false);
|
||||
MinecraftClient.getInstance().getNetworkHandler().onServerTransfer(new ServerTransferS2CPacket(newAddress.getHostString(), newAddress.getPort()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public class ViaFabricPlusVLLegacyPipeline extends VLLegacyPipeline {
|
||||
|
||||
@Override
|
||||
protected String packetDecoderName() {
|
||||
return "decoder";
|
||||
return "inbound_config";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,14 +26,14 @@ import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_20_5;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ServerboundPackets1_20_5;
|
||||
import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.NetworkSide;
|
||||
import net.minecraft.network.NetworkState;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket;
|
||||
import net.minecraft.network.RegistryByteBuf;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.ClientboundPacketsb1_8;
|
||||
@ -43,7 +43,6 @@ import net.raphimc.vialegacy.protocols.release.protocol1_4_4_5to1_4_2.types.Type
|
||||
public class ItemTranslator {
|
||||
|
||||
private static final UserConnection VIA_B1_8_TO_MC_USER_CONNECTION = ProtocolTranslator.createDummyUserConnection(ProtocolTranslator.NATIVE_VERSION, LegacyProtocolVersion.b1_8tob1_8_1);
|
||||
private static final int CREATIVE_INVENTORY_ACTION_ID = NetworkState.PLAY.getHandler(NetworkSide.SERVERBOUND).getId(new CreativeInventoryActionC2SPacket(0, ItemStack.EMPTY));
|
||||
|
||||
/**
|
||||
* Converts a Minecraft item stack to a ViaVersion item stack
|
||||
@ -56,11 +55,11 @@ public class ItemTranslator {
|
||||
final UserConnection user = ProtocolTranslator.createDummyUserConnection(ProtocolTranslator.NATIVE_VERSION, targetVersion);
|
||||
|
||||
try {
|
||||
final PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
|
||||
final RegistryByteBuf buf = new RegistryByteBuf(Unpooled.buffer(), MinecraftClient.getInstance().getNetworkHandler().getRegistryManager());
|
||||
buf.writeShort(0); // slot
|
||||
buf.writeItemStack(stack); // item
|
||||
ItemStack.OPTIONAL_PACKET_CODEC.encode(buf, stack); // item
|
||||
|
||||
final PacketWrapper wrapper = PacketWrapper.create(CREATIVE_INVENTORY_ACTION_ID, buf, user);
|
||||
final PacketWrapper wrapper = PacketWrapper.create(ServerboundPackets1_20_5.CREATIVE_INVENTORY_ACTION.getId(), buf, user);
|
||||
user.getProtocolInfo().getPipeline().transform(Direction.SERVERBOUND, State.PLAY, wrapper);
|
||||
|
||||
wrapper.read(Type.SHORT); // slot
|
||||
@ -86,8 +85,10 @@ public class ItemTranslator {
|
||||
return Type.ITEM1_13;
|
||||
} else if (targetVersion.olderThanOrEqualTo(ProtocolVersion.v1_20_2)) {
|
||||
return Type.ITEM1_13_2;
|
||||
} else {
|
||||
} else if (targetVersion.olderThanOrEqualTo(ProtocolVersion.v1_20_3)) {
|
||||
return Type.ITEM1_20_2;
|
||||
} else {
|
||||
return Types1_20_5.ITEM;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ public class BetaCraftScreen extends VFPScreen {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getScrollbarPositionX() {
|
||||
protected int getScrollbarX() {
|
||||
return this.width - 5;
|
||||
}
|
||||
}
|
||||
@ -115,7 +115,7 @@ public class BetaCraftScreen extends VFPScreen {
|
||||
final ServerAddress serverAddress = ServerAddress.parse(server.socketAddress());
|
||||
final ServerInfo entry = new ServerInfo(server.name(), serverAddress.getAddress(), ServerInfo.ServerType.OTHER);
|
||||
|
||||
ConnectScreen.connect(MinecraftClient.getInstance().currentScreen, MinecraftClient.getInstance(), serverAddress, entry, false);
|
||||
ConnectScreen.connect(MinecraftClient.getInstance().currentScreen, MinecraftClient.getInstance(), serverAddress, entry, false, null);
|
||||
super.mappedMouseClicked(mouseX, mouseY, button);
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,6 @@ import de.florianmichael.viafabricplus.injection.access.IServerInfo;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.impl.provider.vialegacy.ViaFabricPlusClassicMPPassProvider;
|
||||
import de.florianmichael.viafabricplus.screen.VFPListEntry;
|
||||
import de.florianmichael.viafabricplus.screen.VFPScreen;
|
||||
import de.florianmichael.viafabricplus.screen.base.ProtocolSelectionScreen;
|
||||
import de.florianmichael.viafabricplus.settings.impl.AuthenticationSettings;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
@ -111,7 +110,7 @@ public class ClassiCubeServerListScreen extends VFPScreen {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getScrollbarPositionX() {
|
||||
protected int getScrollbarX() {
|
||||
return this.width - 5;
|
||||
}
|
||||
}
|
||||
@ -139,7 +138,7 @@ public class ClassiCubeServerListScreen extends VFPScreen {
|
||||
((IServerInfo) entry).viaFabricPlus$forceVersion(LegacyProtocolVersion.c0_30cpe);
|
||||
}
|
||||
|
||||
ConnectScreen.connect(MinecraftClient.getInstance().currentScreen, MinecraftClient.getInstance(), serverAddress, entry, false);
|
||||
ConnectScreen.connect(MinecraftClient.getInstance().currentScreen, MinecraftClient.getInstance(), serverAddress, entry, false, null);
|
||||
super.mappedMouseClicked(mouseX, mouseY, button);
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ public class SettingsScreen extends VFPScreen {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getScrollbarPositionX() {
|
||||
protected int getScrollbarX() {
|
||||
return this.width - 5;
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,6 @@ public class BedrockSettings extends SettingGroup {
|
||||
}
|
||||
}
|
||||
};
|
||||
public final BooleanSetting openPromptGUIToConfirmTransfer = new BooleanSetting(this, Text.translatable("bedrock_settings.viafabricplus.confirm_transfer_server_prompt"), true);
|
||||
public final BooleanSetting replaceDefaultPort = new BooleanSetting(this, Text.translatable("bedrock_settings.viafabricplus.replace_default_port"), true);
|
||||
|
||||
public BedrockSettings() {
|
||||
|
@ -46,7 +46,6 @@ public class VisualSettings extends SettingGroup {
|
||||
// 1.9 -> 1.8.x
|
||||
public final VersionedBooleanSetting emulateArmorHud = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.emulate_armor_hud"), VersionRange.andOlder(ProtocolVersion.v1_8));
|
||||
public final VersionedBooleanSetting removeNewerFeaturesFromCommandBlockScreen = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.remove_newer_features_from_command_block_screen"), VersionRange.andOlder(ProtocolVersion.v1_8));
|
||||
public final VersionedBooleanSetting showSuperSecretSettings = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.show_super_secret_settings"), VersionRange.andOlder(ProtocolVersion.v1_8));
|
||||
public final VersionedBooleanSetting enableSwordBlocking = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.enable_sword_blocking"), VersionRange.andOlder(ProtocolVersion.v1_8));
|
||||
|
||||
// 1.8.x -> 1.7.6 - 1.7.10
|
||||
|
@ -46,7 +46,6 @@
|
||||
"general_settings.viafabricplus.load_skins_and_skulls_in_legacy_versions": "Skins und Schädel in alten Versionen laden",
|
||||
"general_settings.viafabricplus.emulate_inventory_actions_in_alpha_versions": "Inventaraktionen in Alpha-Versionen emulieren",
|
||||
|
||||
"bedrock_settings.viafabricplus.confirm_transfer_server_prompt": "Bestätigungsfenster öffnen, um das Transferieren zu anderen Servern zu bestätigen",
|
||||
"bedrock_settings.viafabricplus.click_to_set_bedrock_account": "Klicke, um den Account für die Bedrock-Edition einzustellen",
|
||||
"bedrock_settings.viafabricplus.replace_default_port": "Standardport in der Serverliste ersetzen",
|
||||
|
||||
@ -70,7 +69,6 @@
|
||||
"authentication_settings.viafabricplus.automatically_select_cpe_when_using_classicube": "Automatisch CPE auswählen, wenn du die ClassiCube-Serverliste verwendest.",
|
||||
"authentication_settings.viafabricplus.set_session_name_to_classicube_name": "Session-Namen auf ClassiCube-Namen setzen, wenn du die ClassiCube-Serverliste verwendest.",
|
||||
|
||||
"visual_settings.viafabricplus.show_super_secret_settings": "Geheime Einstellungen anzeigen",
|
||||
"visual_settings.viafabricplus.disable_secure_chat_warning": "Warnung für sicheren Chat deaktivieren",
|
||||
"visual_settings.viafabricplus.hide_signature_indicator": "Signaturanzeige verstecken",
|
||||
"visual_settings.viafabricplus.remove_newer_features_from_jigsaw_screen": "Neuere Funktionen vom Puzzle-Block entfernen",
|
||||
|
@ -46,7 +46,6 @@
|
||||
"general_settings.viafabricplus.load_skins_and_skulls_in_legacy_versions": "Load skins and skulls in legacy versions",
|
||||
"general_settings.viafabricplus.emulate_inventory_actions_in_alpha_versions": "Emulate inventory actions in alpha versions",
|
||||
|
||||
"bedrock_settings.viafabricplus.confirm_transfer_server_prompt": "Open prompt GUI to confirm transferring to other servers",
|
||||
"bedrock_settings.viafabricplus.click_to_set_bedrock_account": "Click to set account for Bedrock Edition",
|
||||
"bedrock_settings.viafabricplus.replace_default_port": "Replace default port in server list",
|
||||
|
||||
@ -70,7 +69,6 @@
|
||||
"authentication_settings.viafabricplus.automatically_select_cpe_when_using_classicube": "Automatically select CPE when using the ClassiCube server list",
|
||||
"authentication_settings.viafabricplus.set_session_name_to_classicube_name": "Set session name to ClassiCube name when using the ClassiCube server list",
|
||||
|
||||
"visual_settings.viafabricplus.show_super_secret_settings": "Show Super Secret Settings",
|
||||
"visual_settings.viafabricplus.disable_secure_chat_warning": "Disable Secure Chat warning",
|
||||
"visual_settings.viafabricplus.hide_signature_indicator": "Hide signature indicator",
|
||||
"visual_settings.viafabricplus.remove_newer_features_from_jigsaw_screen": "Remove newer features from the Jigsaw screen",
|
||||
|
@ -46,7 +46,6 @@
|
||||
"general_settings.viafabricplus.load_skins_and_skulls_in_legacy_versions": "cargar skins y cabezas en versiones legacy",
|
||||
"general_settings.viafabricplus.emulate_inventory_actions_in_alpha_versions": "emular acciones de inventario en versiones alpha",
|
||||
|
||||
"bedrock_settings.viafabricplus.confirm_transfer_server_prompt": "Abrir UI de pregunta para confirmar la transferencia a otros servidores",
|
||||
"bedrock_settings.viafabricplus.click_to_set_bedrock_account": "Click para asignar cuenta de Bedrock",
|
||||
|
||||
"debug_settings.viafabricplus.queue_config_packets": "cola de configuración de paquetes",
|
||||
@ -69,7 +68,6 @@
|
||||
"authentication_settings.viafabricplus.automatically_select_cpe_when_using_classicube": "Forzar version CPE si se usa la lista de servidores de ClassiCube.",
|
||||
"authentication_settings.viafabricplus.set_session_name_to_classicube_name": "Asignar nombre de sesión a ClassiCube cuando se usa ClassiCube la lista de ClassiCube.",
|
||||
|
||||
"visual_settings.viafabricplus.show_super_secret_settings": "Mostrar los ajustes super secretos",
|
||||
"visual_settings.viafabricplus.disable_secure_chat_warning": "Desactivar la advertencia de chat seguro",
|
||||
"visual_settings.viafabricplus.hide_signature_indicator": "Ocultar el indicador de firmas",
|
||||
"visual_settings.viafabricplus.remove_newer_features_from_jigsaw_screen": "Eliminar características nuevas de la pantalla de Jigsaw",
|
||||
|
@ -46,7 +46,6 @@
|
||||
"general_settings.viafabricplus.load_skins_and_skulls_in_legacy_versions": "cargar skins y cabezas en versiones legacy",
|
||||
"general_settings.viafabricplus.emulate_inventory_actions_in_alpha_versions": "emular acciones de inventario en versiones alpha",
|
||||
|
||||
"bedrock_settings.viafabricplus.confirm_transfer_server_prompt": "Abrir UI de pregunta para confirmar la transferencia a otros servidores",
|
||||
"bedrock_settings.viafabricplus.click_to_set_bedrock_account": "Click para asignar cuenta de Bedrock",
|
||||
|
||||
"debug_settings.viafabricplus.queue_config_packets": "cola de configuración de paquetes",
|
||||
@ -69,7 +68,6 @@
|
||||
"authentication_settings.viafabricplus.automatically_select_cpe_when_using_classicube": "Forzar version CPE si se usa la lista de servidores de ClassiCube.",
|
||||
"authentication_settings.viafabricplus.set_session_name_to_classicube_name": "Asignar nombre de sesión a ClassiCube cuando se usa ClassiCube la lista de ClassiCube.",
|
||||
|
||||
"visual_settings.viafabricplus.show_super_secret_settings": "Mostrar los ajustes super secretos",
|
||||
"visual_settings.viafabricplus.disable_secure_chat_warning": "Desactivar la advertencia de chat seguro",
|
||||
"visual_settings.viafabricplus.hide_signature_indicator": "Ocultar el indicador de firmas",
|
||||
"visual_settings.viafabricplus.remove_newer_features_from_jigsaw_screen": "Eliminar características nuevas de la pantalla de Jigsaw",
|
||||
|
@ -46,7 +46,6 @@
|
||||
"general_settings.viafabricplus.load_skins_and_skulls_in_legacy_versions": "cargar skins y cabezas en versiones legacy",
|
||||
"general_settings.viafabricplus.emulate_inventory_actions_in_alpha_versions": "emular acciones de inventario en versiones alpha",
|
||||
|
||||
"bedrock_settings.viafabricplus.confirm_transfer_server_prompt": "Abrir UI de pregunta para confirmar la transferencia a otros servidores",
|
||||
"bedrock_settings.viafabricplus.click_to_set_bedrock_account": "Click para asignar cuenta de Bedrock",
|
||||
|
||||
"debug_settings.viafabricplus.queue_config_packets": "cola de configuración de paquetes",
|
||||
@ -69,7 +68,6 @@
|
||||
"authentication_settings.viafabricplus.automatically_select_cpe_when_using_classicube": "Forzar version CPE si se usa la lista de servidores de ClassiCube.",
|
||||
"authentication_settings.viafabricplus.set_session_name_to_classicube_name": "Asignar nombre de sesión a ClassiCube cuando se usa ClassiCube la lista de ClassiCube.",
|
||||
|
||||
"visual_settings.viafabricplus.show_super_secret_settings": "Mostrar los ajustes super secretos",
|
||||
"visual_settings.viafabricplus.disable_secure_chat_warning": "Desactivar la advertencia de chat seguro",
|
||||
"visual_settings.viafabricplus.hide_signature_indicator": "Ocultar el indicador de firmas",
|
||||
"visual_settings.viafabricplus.remove_newer_features_from_jigsaw_screen": "Eliminar características nuevas de la pantalla de Jigsaw",
|
||||
|
@ -46,7 +46,6 @@
|
||||
"general_settings.viafabricplus.load_skins_and_skulls_in_legacy_versions": "cargar skins y cabezas en versiones legacy",
|
||||
"general_settings.viafabricplus.emulate_inventory_actions_in_alpha_versions": "emular acciones de inventario en versiones alpha",
|
||||
|
||||
"bedrock_settings.viafabricplus.confirm_transfer_server_prompt": "Abrir UI de pregunta para confirmar la transferencia a otros servidores",
|
||||
"bedrock_settings.viafabricplus.click_to_set_bedrock_account": "Click para asignar cuenta de Bedrock",
|
||||
|
||||
"debug_settings.viafabricplus.queue_config_packets": "cola de configuración de paquetes",
|
||||
@ -69,7 +68,6 @@
|
||||
"authentication_settings.viafabricplus.automatically_select_cpe_when_using_classicube": "Forzar version CPE si se usa la lista de servidores de ClassiCube.",
|
||||
"authentication_settings.viafabricplus.set_session_name_to_classicube_name": "Asignar nombre de sesión a ClassiCube cuando se usa ClassiCube la lista de ClassiCube.",
|
||||
|
||||
"visual_settings.viafabricplus.show_super_secret_settings": "Mostrar los ajustes super secretos",
|
||||
"visual_settings.viafabricplus.disable_secure_chat_warning": "Desactivar la advertencia de chat seguro",
|
||||
"visual_settings.viafabricplus.hide_signature_indicator": "Ocultar el indicador de firmas",
|
||||
"visual_settings.viafabricplus.remove_newer_features_from_jigsaw_screen": "Eliminar características nuevas de la pantalla de Jigsaw",
|
||||
|
@ -46,7 +46,6 @@
|
||||
"general_settings.viafabricplus.load_skins_and_skulls_in_legacy_versions": "cargar skins y cabezas en versiones legacy",
|
||||
"general_settings.viafabricplus.emulate_inventory_actions_in_alpha_versions": "emular acciones de inventario en versiones alpha",
|
||||
|
||||
"bedrock_settings.viafabricplus.confirm_transfer_server_prompt": "Abrir UI de pregunta para confirmar la transferencia a otros servidores",
|
||||
"bedrock_settings.viafabricplus.click_to_set_bedrock_account": "Click para asignar cuenta de Bedrock",
|
||||
|
||||
"debug_settings.viafabricplus.queue_config_packets": "cola de configuración de paquetes",
|
||||
@ -69,7 +68,6 @@
|
||||
"authentication_settings.viafabricplus.automatically_select_cpe_when_using_classicube": "Forzar version CPE si se usa la lista de servidores de ClassiCube.",
|
||||
"authentication_settings.viafabricplus.set_session_name_to_classicube_name": "Asignar nombre de sesión a ClassiCube cuando se usa ClassiCube la lista de ClassiCube.",
|
||||
|
||||
"visual_settings.viafabricplus.show_super_secret_settings": "Mostrar los ajustes super secretos",
|
||||
"visual_settings.viafabricplus.disable_secure_chat_warning": "Desactivar la advertencia de chat seguro",
|
||||
"visual_settings.viafabricplus.hide_signature_indicator": "Ocultar el indicador de firmas",
|
||||
"visual_settings.viafabricplus.remove_newer_features_from_jigsaw_screen": "Eliminar características nuevas de la pantalla de Jigsaw",
|
||||
|
@ -46,7 +46,6 @@
|
||||
"general_settings.viafabricplus.load_skins_and_skulls_in_legacy_versions": "cargar skins y cabezas en versiones legacy",
|
||||
"general_settings.viafabricplus.emulate_inventory_actions_in_alpha_versions": "emular acciones de inventario en versiones alpha",
|
||||
|
||||
"bedrock_settings.viafabricplus.confirm_transfer_server_prompt": "Abrir UI de pregunta para confirmar la transferencia a otros servidores",
|
||||
"bedrock_settings.viafabricplus.click_to_set_bedrock_account": "Click para asignar cuenta de Bedrock",
|
||||
|
||||
"debug_settings.viafabricplus.queue_config_packets": "cola de configuración de paquetes",
|
||||
@ -69,7 +68,6 @@
|
||||
"authentication_settings.viafabricplus.automatically_select_cpe_when_using_classicube": "Forzar version CPE si se usa la lista de servidores de ClassiCube.",
|
||||
"authentication_settings.viafabricplus.set_session_name_to_classicube_name": "Asignar nombre de sesión a ClassiCube cuando se usa ClassiCube la lista de ClassiCube.",
|
||||
|
||||
"visual_settings.viafabricplus.show_super_secret_settings": "Mostrar los ajustes super secretos",
|
||||
"visual_settings.viafabricplus.disable_secure_chat_warning": "Desactivar la advertencia de chat seguro",
|
||||
"visual_settings.viafabricplus.hide_signature_indicator": "Ocultar el indicador de firmas",
|
||||
"visual_settings.viafabricplus.remove_newer_features_from_jigsaw_screen": "Eliminar características nuevas de la pantalla de Jigsaw",
|
||||
|
@ -46,7 +46,6 @@
|
||||
"general_settings.viafabricplus.load_skins_and_skulls_in_legacy_versions": "cargar skins y cabezas en versiones legacy",
|
||||
"general_settings.viafabricplus.emulate_inventory_actions_in_alpha_versions": "emular acciones de inventario en versiones alpha",
|
||||
|
||||
"bedrock_settings.viafabricplus.confirm_transfer_server_prompt": "Abrir UI de pregunta para confirmar la transferencia a otros servidores",
|
||||
"bedrock_settings.viafabricplus.click_to_set_bedrock_account": "Click para asignar cuenta de Bedrock",
|
||||
|
||||
"debug_settings.viafabricplus.queue_config_packets": "cola de configuración de paquetes",
|
||||
@ -69,7 +68,6 @@
|
||||
"authentication_settings.viafabricplus.automatically_select_cpe_when_using_classicube": "Forzar version CPE si se usa la lista de servidores de ClassiCube.",
|
||||
"authentication_settings.viafabricplus.set_session_name_to_classicube_name": "Asignar nombre de sesión a ClassiCube cuando se usa ClassiCube la lista de ClassiCube.",
|
||||
|
||||
"visual_settings.viafabricplus.show_super_secret_settings": "Mostrar los ajustes super secretos",
|
||||
"visual_settings.viafabricplus.disable_secure_chat_warning": "Desactivar la advertencia de chat seguro",
|
||||
"visual_settings.viafabricplus.hide_signature_indicator": "Ocultar el indicador de firmas",
|
||||
"visual_settings.viafabricplus.remove_newer_features_from_jigsaw_screen": "Eliminar características nuevas de la pantalla de Jigsaw",
|
||||
|
@ -44,7 +44,6 @@
|
||||
"general_settings.viafabricplus.load_skins_and_skulls_in_legacy_versions": "Skinek és fejek betöltése elavult verziókban",
|
||||
"general_settings.viafabricplus.emulate_inventory_actions_in_alpha_versions": "Felszerelési műveletek emulálása alpha verziókban",
|
||||
|
||||
"bedrock_settings.viafabricplus.confirm_transfer_server_prompt": "Kérdő GUI megnyitása szerverváltás megerősítéséhez",
|
||||
"bedrock_settings.viafabricplus.click_to_set_bedrock_account": "Kattints egy Bedrock Edition fiók beállításához",
|
||||
|
||||
"debug_settings.viafabricplus.queue_config_packets": "Konfigurációs adatcsomagok várólistára állítása",
|
||||
@ -67,7 +66,6 @@
|
||||
"authentication_settings.viafabricplus.automatically_select_cpe_when_using_classicube": "CPE verzió kényszerítése ClassiCube használata esetén",
|
||||
"authentication_settings.viafabricplus.set_session_name_to_classicube_name": "Felh. név hamisítása a ClassiCube névre C. Cube használata esetén",
|
||||
|
||||
"visual_settings.viafabricplus.show_super_secret_settings": "Super Secret Settings mutatása",
|
||||
"visual_settings.viafabricplus.disable_secure_chat_warning": "Biztonságos chat figyelmeztetés kikapcsolása",
|
||||
"visual_settings.viafabricplus.hide_signature_indicator": "Aláírásjelző elrejtése",
|
||||
"visual_settings.viafabricplus.remove_newer_features_from_jigsaw_screen": "Újabb funkciók eltávolítása a Kirakósblokk képernyőről",
|
||||
|
@ -46,7 +46,6 @@
|
||||
"general_settings.viafabricplus.load_skins_and_skulls_in_legacy_versions": "Ładuj skórki graczy w starszych wersjach gry",
|
||||
"general_settings.viafabricplus.emulate_inventory_actions_in_alpha_versions": "Emuluj akcje ekwipunku w wersjach alpha",
|
||||
|
||||
"bedrock_settings.viafabricplus.confirm_transfer_server_prompt": "Pytaj, żeby potwierdzić przełączanie do innych serwerów",
|
||||
"bedrock_settings.viafabricplus.click_to_set_bedrock_account": "Naciśnij, aby ustawić konto dla minecraft bedrock edition",
|
||||
"bedrock_settings.viafabricplus.replace_default_port": "Zamień domyślny port w liście serwerów",
|
||||
|
||||
@ -70,7 +69,6 @@
|
||||
"authentication_settings.viafabricplus.automatically_select_cpe_when_using_classicube": "Automatycznie wybieraj wersję CPE podczas korzystania z listy serwerów ClassiCube",
|
||||
"authentication_settings.viafabricplus.set_session_name_to_classicube_name": "Ustaw nazwę sesji na nazwę ClassiCube podczas korzystania z listy serwerów ClassiCube",
|
||||
|
||||
"visual_settings.viafabricplus.show_super_secret_settings": "Pokazuj super secret settings",
|
||||
"visual_settings.viafabricplus.disable_secure_chat_warning": "Wyłącz ostrzeżenie dotyczące bezpiecznego czatu",
|
||||
"visual_settings.viafabricplus.hide_signature_indicator": "Ukrywaj wskaźnik podpisywania wiadomości na czacie",
|
||||
"visual_settings.viafabricplus.remove_newer_features_from_jigsaw_screen": "Usuń nowsze funkcje z ekranu bloku konstrukcyjnego",
|
||||
|
@ -47,7 +47,6 @@
|
||||
"general_settings.viafabricplus.load_skins_and_skulls_in_legacy_versions": "Скины и головы игроков в старых версиях",
|
||||
"general_settings.viafabricplus.emulate_inventory_actions_in_alpha_versions": "Эмулировать действия в инвентаре в alpha-версиях",
|
||||
|
||||
"bedrock_settings.viafabricplus.confirm_transfer_server_prompt": "Экран подтверждения перехода на другой сервер",
|
||||
"bedrock_settings.viafabricplus.click_to_set_bedrock_account": "Нажмите для настройки учётной записи Bedrock Edition",
|
||||
|
||||
"debug_settings.viafabricplus.queue_config_packets": "Очередь пакетов этапа настройки",
|
||||
@ -70,7 +69,6 @@
|
||||
"authentication_settings.viafabricplus.automatically_select_cpe_when_using_classicube": "Устанавливать версию CPE при использовании ClassiCube",
|
||||
"authentication_settings.viafabricplus.set_session_name_to_classicube_name": "Имя пользователя ClassiCube при его использовании",
|
||||
|
||||
"visual_settings.viafabricplus.show_super_secret_settings": "Вернуть Super Secret Settings",
|
||||
"visual_settings.viafabricplus.disable_secure_chat_warning": "Удалять уведомления о безопасности чата",
|
||||
"visual_settings.viafabricplus.hide_signature_indicator": "Скрывать индикатор цифровой подписи в чате",
|
||||
"visual_settings.viafabricplus.remove_newer_features_from_jigsaw_screen": "Старый блок головоломки",
|
||||
|
@ -43,7 +43,6 @@
|
||||
"general_settings.viafabricplus.load_skins_and_skulls_in_legacy_versions": "Завантажувати скіни та черепи на старих версіях",
|
||||
"general_settings.viafabricplus.emulate_inventory_actions_in_alpha_versions": "Симулювати дії інветаря на альфа версіях",
|
||||
|
||||
"bedrock_settings.viafabricplus.confirm_transfer_server_prompt": "Відкрити GUI підказку для підтвердження переміщення до іншого серверу",
|
||||
"bedrock_settings.viafabricplus.click_to_set_bedrock_account": "Нажміть, щоб встановити аккаунт для Bedrock",
|
||||
|
||||
"debug_settings.viafabricplus.disable_sequencing": "Вимкнути послідовності",
|
||||
|
@ -46,7 +46,6 @@
|
||||
"general_settings.viafabricplus.emulate_inventory_actions_in_alpha_versions": "模拟Alpha版本的物品栏动作",
|
||||
"general_settings.viafabricplus.direct_connect_screen_button_orientation": "直接连接 界面的按钮位置",
|
||||
|
||||
"bedrock_settings.viafabricplus.confirm_transfer_server_prompt": "显示“确认转移到其他服务器”提示",
|
||||
"bedrock_settings.viafabricplus.click_to_set_bedrock_account": "点此连接到基岩版账户",
|
||||
|
||||
"debug_settings.viafabricplus.queue_config_packets": "排列配置数据包",
|
||||
@ -69,7 +68,6 @@
|
||||
"authentication_settings.viafabricplus.automatically_select_cpe_when_using_classicube": "如果使用ClassicCube MP Pass,则强制CPE版本",
|
||||
"authentication_settings.viafabricplus.set_session_name_to_classicube_name": "如果使用ClassiCube,则将用户名显示为ClassiCube名称",
|
||||
|
||||
"visual_settings.viafabricplus.show_super_secret_settings": "显示“Super Secret Settings”(超级秘密设置)",
|
||||
"visual_settings.viafabricplus.disable_secure_chat_warning": "禁用安全聊天警告",
|
||||
"visual_settings.viafabricplus.hide_signature_indicator": "隐藏聊天签名提示",
|
||||
"visual_settings.viafabricplus.remove_newer_features_from_jigsaw_screen": "从§o拼图方块§r界面中移除新版本特性",
|
||||
|
@ -46,7 +46,6 @@
|
||||
"general_settings.viafabricplus.emulate_inventory_actions_in_alpha_versions": "模擬Alpha版本嘅物品欄動作",
|
||||
"general_settings.viafabricplus.direct_connect_screen_button_orientation": "直接連缐 熒幕嘅按鈕方位",
|
||||
|
||||
"bedrock_settings.viafabricplus.confirm_transfer_server_prompt": "打開GUI以確認切換到其它伺服器",
|
||||
"bedrock_settings.viafabricplus.click_to_set_bedrock_account": "點擊以設定基岩版帳戶",
|
||||
|
||||
"debug_settings.viafabricplus.queue_config_packets": "排列配置數據包",
|
||||
@ -69,7 +68,6 @@
|
||||
"authentication_settings.viafabricplus.automatically_select_cpe_when_using_classicube": "如果使用 ClassicCube MP Pass,則強制 CPE 版本",
|
||||
"authentication_settings.viafabricplus.set_session_name_to_classicube_name": "如果使用 ClassiCube ,則顯示為 ClassiCube 名稱",
|
||||
|
||||
"visual_settings.viafabricplus.show_super_secret_settings": "顯示 “Super Secret Settings”(超級秘密設定)",
|
||||
"visual_settings.viafabricplus.disable_secure_chat_warning": "禁用安全聊天警告",
|
||||
"visual_settings.viafabricplus.hide_signature_indicator": "隱藏聊天簽名提示",
|
||||
"visual_settings.viafabricplus.remove_newer_features_from_jigsaw_screen": "從\u00a7o拼圖方塊\u00a7r介面中移除新版本特性",
|
||||
|
@ -46,7 +46,6 @@
|
||||
"general_settings.viafabricplus.emulate_inventory_actions_in_alpha_versions": "模擬 Alpha 版本物品欄動作",
|
||||
"general_settings.viafabricplus.direct_connect_screen_button_orientation": "直接連缐 熒幕的按鈕方位",
|
||||
|
||||
"bedrock_settings.viafabricplus.confirm_transfer_server_prompt": "開啟提示視窗以確認轉換到其他伺服器",
|
||||
"bedrock_settings.viafabricplus.click_to_set_bedrock_account": "點擊以設定 Bedrock 版帳號",
|
||||
|
||||
"debug_settings.viafabricplus.queue_config_packets": "佇列設定封包",
|
||||
@ -69,7 +68,6 @@
|
||||
"authentication_settings.viafabricplus.automatically_select_cpe_when_using_classicube": "如果使用 ClassiCube,強制使用 CPE 版本",
|
||||
"authentication_settings.viafabricplus.set_session_name_to_classicube_name": "如果使用 ClassiCube,偽造使用者名稱為 ClassiCube 名稱",
|
||||
|
||||
"visual_settings.viafabricplus.show_super_secret_settings": "顯示超級祕密設定(Super Secret Settings)",
|
||||
"visual_settings.viafabricplus.disable_secure_chat_warning": "停用受保護的聊天內容警告",
|
||||
"visual_settings.viafabricplus.hide_signature_indicator": "隱藏簽章指示器",
|
||||
"visual_settings.viafabricplus.remove_newer_features_from_jigsaw_screen": "從拼圖方塊畫面中移除較新的功能",
|
||||
|
@ -23,7 +23,7 @@
|
||||
"base.integration.MixinRakSessionCodec",
|
||||
"base.perserverversion.MixinMultiplayerScreen",
|
||||
"base.perserverversion.MixinMultiplayerServerListPinger",
|
||||
"base.perserverversion.MixinPerformanceLog",
|
||||
"base.perserverversion.MixinMultiValueDebugSampleLogImpl",
|
||||
"base.perserverversion.MixinServerInfo",
|
||||
"compat.classic4j.MixinCCAuthenticationResponse",
|
||||
"compat.classic4j.MixinTextFieldWidget",
|
||||
@ -40,7 +40,6 @@
|
||||
"fixes.minecraft.MixinChatInputSuggestor",
|
||||
"fixes.minecraft.MixinClientCommandSource",
|
||||
"fixes.minecraft.MixinClientWorld",
|
||||
"fixes.minecraft.MixinEnchantmentHelper",
|
||||
"fixes.minecraft.MixinFlowableFluid",
|
||||
"fixes.minecraft.MixinFontStorage",
|
||||
"fixes.minecraft.MixinGameOptions",
|
||||
@ -112,38 +111,25 @@
|
||||
"fixes.minecraft.entity.MixinSquidEntity",
|
||||
"fixes.minecraft.entity.MixinWolfEntity",
|
||||
"fixes.minecraft.item.MixinArmorItem",
|
||||
"fixes.minecraft.item.MixinArmorMaterials",
|
||||
"fixes.minecraft.item.MixinAxeItem",
|
||||
"fixes.minecraft.item.MixinBlockItem",
|
||||
"fixes.minecraft.item.MixinBowItem",
|
||||
"fixes.minecraft.item.MixinBrushItem",
|
||||
"fixes.minecraft.item.MixinDrawContext",
|
||||
"fixes.minecraft.item.MixinEnderPearlItem",
|
||||
"fixes.minecraft.item.MixinEquipment",
|
||||
"fixes.minecraft.item.MixinFireworkRocketItem",
|
||||
"fixes.minecraft.item.MixinHeldItemRenderer",
|
||||
"fixes.minecraft.item.MixinHoeItem",
|
||||
"fixes.minecraft.item.MixinItem",
|
||||
"fixes.minecraft.item.MixinItemCooldownManager",
|
||||
"fixes.minecraft.item.MixinItemGroup_EntriesImpl",
|
||||
"fixes.minecraft.item.MixinItemGroups",
|
||||
"fixes.minecraft.item.MixinItemPlacementContext",
|
||||
"fixes.minecraft.item.MixinItemRenderer",
|
||||
"fixes.minecraft.item.MixinItemStack",
|
||||
"fixes.minecraft.item.MixinMiningToolItem",
|
||||
"fixes.minecraft.item.MixinPickaxeItem",
|
||||
"fixes.minecraft.item.MixinShearsItem",
|
||||
"fixes.minecraft.item.MixinShovelItem",
|
||||
"fixes.minecraft.item.MixinSwordItem",
|
||||
"fixes.minecraft.network.MixinChatMessageC2SPacket",
|
||||
"fixes.minecraft.network.MixinClientCommonNetworkHandler",
|
||||
"fixes.minecraft.network.MixinClientConfigurationNetworkHandler",
|
||||
"fixes.minecraft.network.MixinClientLoginNetworkHandler",
|
||||
"fixes.minecraft.network.MixinClientPlayerInteractionManager",
|
||||
"fixes.minecraft.network.MixinClientPlayNetworkHandler",
|
||||
"fixes.minecraft.network.MixinCustomPayloadS2CPacket",
|
||||
"fixes.minecraft.network.MixinMultiplayerServerListPinger",
|
||||
"fixes.minecraft.network.MixinPacketByteBuf",
|
||||
"fixes.minecraft.network.MixinUpdatePlayerAbilitiesC2SPacket",
|
||||
"fixes.minecraft.screen.MixinAbstractCommandBlockScreen",
|
||||
"fixes.minecraft.screen.MixinAbstractSignEditScreen",
|
||||
@ -157,11 +143,9 @@
|
||||
"fixes.minecraft.screen.MixinGameModeSelectionScreen_GameModeSelection",
|
||||
"fixes.minecraft.screen.MixinJigsawBlockScreen",
|
||||
"fixes.minecraft.screen.MixinMouseOptionsScreen",
|
||||
"fixes.minecraft.screen.MixinOptionsScreen",
|
||||
"fixes.minecraft.screen.MixinScreen",
|
||||
"fixes.minecraft.screen.MixinStructureBlockScreen_1",
|
||||
"fixes.minecraft.screen.hud.MixinChatHud",
|
||||
"fixes.minecraft.screen.hud.MixinInGameHud",
|
||||
"fixes.minecraft.screen.screenhandler.MixinAbstractFurnaceScreenHandler",
|
||||
"fixes.minecraft.screen.screenhandler.MixinBrewingStandScreenHandler_FuelSlot",
|
||||
"fixes.minecraft.screen.screenhandler.MixinCraftingScreenHandler",
|
||||
|
Loading…
Reference in New Issue
Block a user