mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-24 12:15:41 +01:00
Start update to 1.21.2
This commit is contained in:
parent
ac5359b8dd
commit
3693b5bdfa
@ -9,10 +9,10 @@ maven_version=3.4.9
|
||||
maven_description=Fabric mod to connect to EVERY Minecraft server version (Release, Beta, Alpha, Classic, Snapshots, Bedrock) with QoL fixes to the gameplay
|
||||
|
||||
# Minecraft/Fabric
|
||||
minecraft_version=1.21.1
|
||||
yarn_version=1.21.1+build.3
|
||||
minecraft_version=1.21.2
|
||||
yarn_version=1.21.2+build.1
|
||||
loader_version=0.16.7
|
||||
fabric_api_version=0.105.0+1.21.1
|
||||
fabric_api_version=0.106.1+1.21.2
|
||||
|
||||
# Set to empty to use the Minecraft version above
|
||||
supported_versions=>=1.21 <=1.21.1
|
||||
supported_versions=1.21.2
|
||||
|
@ -71,9 +71,9 @@ public class EntityDimensionDiff {
|
||||
ProtocolVersion.v1_7_6, EntityDimensionsBuilder.create(EntityType.OCELOT).withChangingDimensions(0.6F, 0.8F).build(),
|
||||
ProtocolVersion.v1_8, EntityType.OCELOT.getDimensions()
|
||||
),
|
||||
EntityType.BOAT, linkedHashMap(
|
||||
ProtocolVersion.v1_8, EntityDimensionsBuilder.create(EntityType.BOAT).withChangingDimensions(1.5F, 0.6F).build(),
|
||||
ProtocolVersion.v1_9, EntityType.BOAT.getDimensions()
|
||||
EntityType.OAK_BOAT, linkedHashMap(
|
||||
ProtocolVersion.v1_8, EntityDimensionsBuilder.create(EntityType.OAK_BOAT).withChangingDimensions(1.5F, 0.6F).build(),
|
||||
ProtocolVersion.v1_9, EntityType.OAK_BOAT.getDimensions()
|
||||
),
|
||||
EntityType.CREEPER, linkedHashMap(
|
||||
ProtocolVersion.v1_8, EntityDimensionsBuilder.create(EntityType.CREEPER).withChangingDimensions(0.6F, 1.8F).build(),
|
||||
|
@ -29,7 +29,6 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.recipe.RecipeSerializer;
|
||||
import net.minecraft.recipe.SpecialCraftingRecipe;
|
||||
import net.minecraft.recipe.SpecialRecipeSerializer;
|
||||
import net.minecraft.recipe.book.CraftingRecipeCategory;
|
||||
import net.minecraft.recipe.input.CraftingRecipeInput;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
@ -48,7 +47,7 @@ public class AddBannerPatternRecipe extends SpecialCraftingRecipe {
|
||||
@Override
|
||||
public boolean matches(CraftingRecipeInput inv, World world) {
|
||||
boolean foundBanner = false;
|
||||
for (int i = 0; i < inv.getSize(); i++) {
|
||||
for (int i = 0; i < inv.size(); i++) {
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
if (stack.getItem() instanceof BannerItem) {
|
||||
if (foundBanner)
|
||||
@ -65,7 +64,7 @@ public class AddBannerPatternRecipe extends SpecialCraftingRecipe {
|
||||
public ItemStack craft(CraftingRecipeInput inv, RegistryWrapper.WrapperLookup lookup) {
|
||||
ItemStack result = ItemStack.EMPTY;
|
||||
|
||||
for (int i = 0; i < inv.getSize(); i++) {
|
||||
for (int i = 0; i < inv.size(); i++) {
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
if (!stack.isEmpty() && stack.getItem() instanceof BannerItem) {
|
||||
result = stack.copy();
|
||||
@ -76,9 +75,9 @@ public class AddBannerPatternRecipe extends SpecialCraftingRecipe {
|
||||
|
||||
final BannerPattern_1_13_2 pattern = getBannerPattern(inv);
|
||||
if (pattern != null) {
|
||||
final var patternKey = lookup.getWrapperOrThrow(RegistryKeys.BANNER_PATTERN).getOrThrow(pattern.getKey());
|
||||
final var patternKey = lookup.getOrThrow(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.getSize(); i++) {
|
||||
for (int i = 0; i < inv.size(); i++) {
|
||||
Item item = inv.getStackInSlot(i).getItem();
|
||||
if (item instanceof DyeItem dyeItem) {
|
||||
color = dyeItem.getColor();
|
||||
@ -96,11 +95,6 @@ public class AddBannerPatternRecipe extends SpecialCraftingRecipe {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean fits(int width, int height) {
|
||||
return width >= 3 && height >= 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeSerializer<AddBannerPatternRecipe> getSerializer() {
|
||||
return SERIALIZER;
|
||||
@ -115,7 +109,7 @@ public class AddBannerPatternRecipe extends SpecialCraftingRecipe {
|
||||
if (pattern.hasBaseStack()) {
|
||||
boolean foundBaseItem = false;
|
||||
boolean foundDye = false;
|
||||
for (int i = 0; i < inv.getSize(); i++) {
|
||||
for (int i = 0; i < inv.size(); i++) {
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
if (!stack.isEmpty() && !(stack.getItem() instanceof BannerItem)) {
|
||||
if (stack.getItem() instanceof DyeItem) {
|
||||
@ -134,9 +128,9 @@ public class AddBannerPatternRecipe extends SpecialCraftingRecipe {
|
||||
}
|
||||
}
|
||||
if (!foundBaseItem || (!foundDye && ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_10))) matches = false;
|
||||
} else if (inv.getSize() == pattern.getRecipePattern().length * pattern.getRecipePattern()[0].length()) {
|
||||
} else if (inv.size() == pattern.getRecipePattern().length * pattern.getRecipePattern()[0].length()) {
|
||||
DyeColor patternColor = null;
|
||||
for (int i = 0; i < inv.getSize(); i++) {
|
||||
for (int i = 0; i < inv.size(); i++) {
|
||||
int row = i / 3;
|
||||
int col = i % 3;
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
|
@ -19,23 +19,21 @@
|
||||
|
||||
package de.florianmichael.viafabricplus.fixes.versioned.visual;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.minecraft.client.model.*;
|
||||
import net.minecraft.client.render.entity.model.CompositeEntityModel;
|
||||
import net.minecraft.client.render.entity.model.EntityModel;
|
||||
import net.minecraft.client.render.entity.model.EntityModelLayer;
|
||||
import net.minecraft.entity.vehicle.BoatEntity;
|
||||
import net.minecraft.client.render.entity.state.BoatEntityRenderState;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
/**
|
||||
* Model for boats in 1.8 and lower.
|
||||
*/
|
||||
public class BoatModel1_8 extends CompositeEntityModel<BoatEntity> {
|
||||
public class BoatModel1_8 extends EntityModel<BoatEntityRenderState> {
|
||||
|
||||
public static final EntityModelLayer MODEL_LAYER = new EntityModelLayer(Identifier.of("viafabricplus", "boat1_8"), "main");
|
||||
private final ImmutableList<ModelPart> parts;
|
||||
|
||||
public BoatModel1_8(ModelPart root) {
|
||||
this.parts = ImmutableList.of(root.getChild("bottom"), root.getChild("back"), root.getChild("front"), root.getChild("right"), root.getChild("left"));
|
||||
super(root);
|
||||
}
|
||||
|
||||
public static TexturedModelData getTexturedModelData() {
|
||||
@ -54,12 +52,7 @@ public class BoatModel1_8 extends CompositeEntityModel<BoatEntity> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<ModelPart> getParts() {
|
||||
return parts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAngles(BoatEntity entity, float limbAngle, float limbDistance, float animationProgress, float headYaw, float headPitch) {
|
||||
public void setAngles(BoatEntityRenderState state) {
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,12 +20,14 @@
|
||||
package de.florianmichael.viafabricplus.fixes.versioned.visual;
|
||||
|
||||
import net.minecraft.client.render.OverlayTexture;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.render.entity.EntityRenderer;
|
||||
import net.minecraft.client.render.entity.AbstractBoatEntityRenderer;
|
||||
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||
import net.minecraft.client.render.entity.model.EntityModel;
|
||||
import net.minecraft.client.render.entity.state.BoatEntityRenderState;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.vehicle.BoatEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.RotationAxis;
|
||||
@ -33,7 +35,7 @@ import net.minecraft.util.math.RotationAxis;
|
||||
/**
|
||||
* Renderer for boats in 1.8 and lower.
|
||||
*/
|
||||
public class BoatRenderer1_8 extends EntityRenderer<BoatEntity> {
|
||||
public class BoatRenderer1_8 extends AbstractBoatEntityRenderer {
|
||||
|
||||
private static final Identifier TEXTURE = Identifier.of("viafabricplus", "textures/boat1_8.png");
|
||||
private final BoatModel1_8 model;
|
||||
@ -45,33 +47,32 @@ public class BoatRenderer1_8 extends EntityRenderer<BoatEntity> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier getTexture(BoatEntity entity) {
|
||||
return TEXTURE;
|
||||
protected EntityModel<BoatEntityRenderState> getModel() {
|
||||
return this.model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(BoatEntity entity, float yaw, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light) {
|
||||
protected RenderLayer getRenderLayer() {
|
||||
return this.model.getLayer(TEXTURE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(BoatEntityRenderState state, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light) {
|
||||
matrices.push();
|
||||
matrices.translate(0, 0.25, 0);
|
||||
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(180 - yaw));
|
||||
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(180 - state.yaw));
|
||||
|
||||
float damageWobbleTicks = entity.getDamageWobbleTicks() - tickDelta;
|
||||
float damageWobbleStrength = entity.getDamageWobbleStrength() - tickDelta;
|
||||
|
||||
if (damageWobbleStrength < 0) {
|
||||
damageWobbleStrength = 0;
|
||||
}
|
||||
if (damageWobbleTicks > 0) {
|
||||
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(MathHelper.sin(damageWobbleTicks) * damageWobbleTicks * damageWobbleStrength / 10 * entity.getDamageWobbleSide()));
|
||||
if (state.damageWobbleTicks > 0) {
|
||||
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(MathHelper.sin(state.damageWobbleTicks) * state.damageWobbleTicks * state.damageWobbleStrength / 10 * state.damageWobbleSide));
|
||||
}
|
||||
|
||||
matrices.scale(-1, -1, 1);
|
||||
model.setAngles(entity, tickDelta, 0, -0.1f, 0, 0);
|
||||
model.setAngles(state);
|
||||
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(model.getLayer(TEXTURE));
|
||||
model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV);
|
||||
|
||||
matrices.pop();
|
||||
super.render(entity, yaw, tickDelta, matrices, vertexConsumers, light);
|
||||
super.render(state, matrices, vertexConsumers, light);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,8 +19,8 @@
|
||||
|
||||
package de.florianmichael.viafabricplus.fixes.versioned.visual;
|
||||
|
||||
import net.minecraft.client.font.BakedGlyph;
|
||||
import net.minecraft.client.font.Glyph;
|
||||
import net.minecraft.client.font.GlyphRenderer;
|
||||
import net.minecraft.client.font.RenderableGlyph;
|
||||
|
||||
import java.util.function.Function;
|
||||
@ -41,7 +41,7 @@ public enum BuiltinEmptyGlyph1_12_2 implements Glyph {
|
||||
}
|
||||
|
||||
@Override
|
||||
public GlyphRenderer bake(Function<RenderableGlyph, GlyphRenderer> glyphRendererGetter) {
|
||||
public BakedGlyph bake(Function<RenderableGlyph, BakedGlyph> glyphRendererGetter) {
|
||||
return glyphRendererGetter.apply(new RenderableGlyph() {
|
||||
|
||||
@Override
|
||||
|
@ -22,9 +22,7 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
|
||||
import de.florianmichael.viafabricplus.fixes.versioned.PendingUpdateManager1_18_2;
|
||||
import de.florianmichael.viafabricplus.injection.access.IEntity;
|
||||
import de.florianmichael.viafabricplus.settings.impl.DebugSettings;
|
||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||
import net.minecraft.client.network.PendingUpdateManager;
|
||||
import net.minecraft.client.render.WorldRenderer;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
@ -33,7 +31,7 @@ import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.registry.entry.RegistryEntry;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.profiler.Profiler;
|
||||
import net.minecraft.util.profiler.Profilers;
|
||||
import net.minecraft.world.EntityList;
|
||||
import net.minecraft.world.MutableWorldProperties;
|
||||
import net.minecraft.world.World;
|
||||
@ -43,8 +41,6 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@Mixin(value = ClientWorld.class, priority = 900)
|
||||
public abstract class MixinClientWorld extends World {
|
||||
|
||||
@ -57,12 +53,12 @@ public abstract class MixinClientWorld extends World {
|
||||
@Final
|
||||
private PendingUpdateManager pendingUpdateManager;
|
||||
|
||||
protected MixinClientWorld(MutableWorldProperties properties, RegistryKey<World> registryRef, DynamicRegistryManager registryManager, RegistryEntry<DimensionType> dimensionEntry, Supplier<Profiler> profiler, boolean isClient, boolean debugWorld, long biomeAccess, int maxChainedNeighborUpdates) {
|
||||
super(properties, registryRef, registryManager, dimensionEntry, profiler, isClient, debugWorld, biomeAccess, maxChainedNeighborUpdates);
|
||||
protected MixinClientWorld(MutableWorldProperties properties, RegistryKey<World> registryRef, DynamicRegistryManager registryManager, RegistryEntry<DimensionType> dimensionEntry, boolean isClient, boolean debugWorld, long seed, int maxChainedNeighborUpdates) {
|
||||
super(properties, registryRef, registryManager, dimensionEntry, isClient, debugWorld, seed, maxChainedNeighborUpdates);
|
||||
}
|
||||
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
private void removePendingUpdateManager(ClientPlayNetworkHandler networkHandler, ClientWorld.Properties properties, RegistryKey<World> registryRef, RegistryEntry<DimensionType> dimensionTypeEntry, int loadDistance, int simulationDistance, Supplier<Profiler> profiler, WorldRenderer worldRenderer, boolean debugWorld, long seed, CallbackInfo ci) {
|
||||
private void removePendingUpdateManager(CallbackInfo ci) {
|
||||
if (DebugSettings.global().disableSequencing.isEnabled()) {
|
||||
this.pendingUpdateManager = new PendingUpdateManager1_18_2();
|
||||
}
|
||||
@ -78,9 +74,9 @@ public abstract class MixinClientWorld extends World {
|
||||
final IEntity mixinEntity = (IEntity) entity;
|
||||
if (mixinEntity.viaFabricPlus$isInLoadedChunkAndShouldTick() || entity.isSpectator()) {
|
||||
entity.age++;
|
||||
this.getProfiler().push(() -> Registries.ENTITY_TYPE.getId(entity.getType()).toString());
|
||||
Profilers.get().push(() -> Registries.ENTITY_TYPE.getId(entity.getType()).toString());
|
||||
entity.tick();
|
||||
this.getProfiler().pop();
|
||||
Profilers.get().pop();
|
||||
}
|
||||
this.viaFabricPlus$checkChunk(entity);
|
||||
|
||||
@ -120,7 +116,6 @@ public abstract class MixinClientWorld extends World {
|
||||
|
||||
@Unique
|
||||
private void viaFabricPlus$checkChunk(Entity entity) {
|
||||
this.getProfiler().push("chunkCheck");
|
||||
final IEntity mixinEntity = (IEntity) entity;
|
||||
final int chunkX = MathHelper.floor(entity.getX() / 16.0D);
|
||||
final int chunkZ = MathHelper.floor(entity.getZ() / 16.0D);
|
||||
@ -129,7 +124,6 @@ public abstract class MixinClientWorld extends World {
|
||||
mixinEntity.viaFabricPlus$setInLoadedChunkAndShouldTick(true);
|
||||
}
|
||||
}
|
||||
this.getProfiler().pop();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public abstract class MixinGameRenderer {
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
MinecraftClient client;
|
||||
private MinecraftClient client;
|
||||
|
||||
@ModifyExpressionValue(method = "findCrosshairTarget", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;raycast(DFZ)Lnet/minecraft/util/hit/HitResult;"))
|
||||
private HitResult bedrockReachAroundRaycast(HitResult hitResult) {
|
||||
|
@ -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;
|
||||
@ -42,14 +42,14 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
public abstract class MixinAbstractSignBlock {
|
||||
|
||||
@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) {
|
||||
private void changeInteractionCalculation(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit, CallbackInfoReturnable<ActionResult> cir) {
|
||||
if (!world.isClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
|
||||
// <= 1.14.4 doesn't have any sign interactions.
|
||||
cir.setReturnValue(ItemActionResult.SUCCESS);
|
||||
cir.setReturnValue(ActionResult.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 ? ItemActionResult.SUCCESS : ItemActionResult.CONSUME);
|
||||
cir.setReturnValue(isSuccess ? ActionResult.SUCCESS : ActionResult.CONSUME);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.injection.ViaFabricPlusMixinPlugin;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.state.property.DirectionProperty;
|
||||
import net.minecraft.state.property.EnumProperty;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
@ -47,7 +47,7 @@ public abstract class MixinAnvilBlock extends FallingBlock {
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
public static DirectionProperty FACING;
|
||||
public static EnumProperty<Direction> FACING;
|
||||
|
||||
public MixinAnvilBlock(Settings settings) {
|
||||
super(settings);
|
||||
@ -66,11 +66,11 @@ public abstract class MixinAnvilBlock extends FallingBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getCullingShape(BlockState state, BlockView world, BlockPos pos) {
|
||||
protected VoxelShape getCullingShape(BlockState state) {
|
||||
// Workaround for https://github.com/ViaVersion/ViaFabricPlus/issues/246
|
||||
// MoreCulling is caching the culling shape and doesn't reload it, so we have to force vanilla's shape here.
|
||||
viaFabricPlus$requireOriginalShape = true;
|
||||
return super.getCullingShape(state, world, pos);
|
||||
return super.getCullingShape(state);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -64,11 +64,11 @@ public abstract class MixinBedBlock extends HorizontalFacingBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getCullingShape(BlockState state, BlockView world, BlockPos pos) {
|
||||
public VoxelShape getCullingShape(BlockState state) {
|
||||
// Workaround for https://github.com/ViaVersion/ViaFabricPlus/issues/246
|
||||
// MoreCulling is caching the culling shape and doesn't reload it, so we have to force vanilla's shape here.
|
||||
viaFabricPlus$requireOriginalShape = true;
|
||||
return super.getCullingShape(state, world, pos);
|
||||
return super.getCullingShape(state);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -60,11 +60,11 @@ public abstract class MixinCauldronBlock extends AbstractCauldronBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getCullingShape(BlockState state, BlockView world, BlockPos pos) {
|
||||
public VoxelShape getCullingShape(BlockState state) {
|
||||
// Workaround for https://github.com/ViaVersion/ViaFabricPlus/issues/246
|
||||
// MoreCulling is caching the culling shape and doesn't reload it, so we have to force vanilla's shape here.
|
||||
viaFabricPlus$requireOriginalShape = true;
|
||||
return super.getCullingShape(state, world, pos);
|
||||
return super.getCullingShape(state);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ public abstract class MixinChestBlock extends AbstractChestBlock<ChestBlockEntit
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getCullingShape(BlockState state, BlockView view, BlockPos pos) {
|
||||
public VoxelShape getCullingShape(BlockState state) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_4_2)) {
|
||||
if (state.get(ChestBlock.CHEST_TYPE) == ChestType.SINGLE) {
|
||||
return SINGLE_SHAPE;
|
||||
@ -89,7 +89,7 @@ public abstract class MixinChestBlock extends AbstractChestBlock<ChestBlockEntit
|
||||
};
|
||||
}
|
||||
} else {
|
||||
return super.getCullingShape(state, view, pos);
|
||||
return super.getCullingShape(state);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,8 @@ import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.DecoratedPotBlock;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
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;
|
||||
@ -39,9 +39,9 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
public abstract class MixinDecoratedPotBlock {
|
||||
|
||||
@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) {
|
||||
private void alwaysPass(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit, CallbackInfoReturnable<ActionResult> cir) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_2)) {
|
||||
cir.setReturnValue(ItemActionResult.SKIP_DEFAULT_BLOCK_INTERACTION);
|
||||
cir.setReturnValue(ActionResult.PASS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,11 +55,11 @@ public abstract class MixinEnderChestBlock extends BlockWithEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getCullingShape(BlockState state, BlockView view, BlockPos pos) {
|
||||
public VoxelShape getCullingShape(BlockState state) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_4_2)) {
|
||||
return SHAPE;
|
||||
} else {
|
||||
return super.getCullingShape(state, view, pos);
|
||||
return super.getCullingShape(state);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,11 +55,11 @@ public abstract class MixinFarmlandBlock extends Block {
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getCullingShape(BlockState state, BlockView view, BlockPos pos) {
|
||||
public VoxelShape getCullingShape(BlockState state) {
|
||||
if (ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_9_3)) {
|
||||
return SHAPE;
|
||||
} else {
|
||||
return super.getCullingShape(state, view, pos);
|
||||
return super.getCullingShape(state);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.ItemActionResult;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
@ -52,9 +52,9 @@ public abstract class MixinFenceBlock extends HorizontalConnectingBlock {
|
||||
}
|
||||
|
||||
@Inject(method = "onUseWithItem", at = @At("HEAD"), cancellable = true)
|
||||
private void alwaysSuccess(CallbackInfoReturnable<ItemActionResult> cir) {
|
||||
private void alwaysSuccess(CallbackInfoReturnable<ActionResult> cir) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_10)) {
|
||||
cir.setReturnValue(ItemActionResult.SUCCESS);
|
||||
cir.setReturnValue(ActionResult.SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,10 +67,10 @@ public abstract class MixinHopperBlock extends BlockWithEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getCullingShape(BlockState state, BlockView world, BlockPos pos) {
|
||||
public VoxelShape getCullingShape(BlockState state) {
|
||||
// Workaround for https://github.com/ViaVersion/ViaFabricPlus/issues/45
|
||||
viaFabricPlus$requireOriginalShape = true;
|
||||
return super.getCullingShape(state, world, pos);
|
||||
return super.getCullingShape(state);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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.ItemActionResult;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
@ -32,9 +32,9 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
public abstract class MixinNoteBlock {
|
||||
|
||||
@Inject(method = "onUseWithItem", at = @At("HEAD"), cancellable = true)
|
||||
private void cancelMobHeadUsage(CallbackInfoReturnable<ItemActionResult> cir) {
|
||||
private void cancelMobHeadUsage(CallbackInfoReturnable<ActionResult> cir) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_4)) {
|
||||
cir.setReturnValue(ItemActionResult.SUCCESS);
|
||||
cir.setReturnValue(ActionResult.SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ public abstract class MixinPistonBlock extends FacingBlock {
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getCullingShape(BlockState state, BlockView world, BlockPos pos) {
|
||||
public VoxelShape getCullingShape(BlockState state) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_1)) {
|
||||
if (state.get(PistonBlock.EXTENDED)) {
|
||||
return switch (state.get(FACING)) {
|
||||
@ -90,7 +90,7 @@ public abstract class MixinPistonBlock extends FacingBlock {
|
||||
return VoxelShapes.fullCube();
|
||||
}
|
||||
} else {
|
||||
return super.getCullingShape(state, world, pos);
|
||||
return super.getCullingShape(state);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,11 +99,11 @@ public abstract class MixinWallBlock extends Block {
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getCullingShape(BlockState state, BlockView world, BlockPos pos) {
|
||||
public VoxelShape getCullingShape(BlockState state) {
|
||||
if (state.get(WallBlock.UP) && ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_2)) {
|
||||
return this.shapeMap.get(state);
|
||||
} else {
|
||||
return super.getCullingShape(state, world, pos);
|
||||
return super.getCullingShape(state);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@ import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.MovementType;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.vehicle.AbstractBoatEntity;
|
||||
import net.minecraft.entity.vehicle.BoatEntity;
|
||||
import net.minecraft.entity.vehicle.VehicleEntity;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
@ -51,8 +52,8 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(BoatEntity.class)
|
||||
public abstract class MixinBoatEntity extends VehicleEntity {
|
||||
@Mixin(AbstractBoatEntity.class)
|
||||
public abstract class MixinAbstractBoatEntity extends VehicleEntity {
|
||||
|
||||
@Shadow
|
||||
private double x;
|
||||
@ -72,9 +73,6 @@ public abstract class MixinBoatEntity extends VehicleEntity {
|
||||
@Shadow
|
||||
private BoatEntity.Location location;
|
||||
|
||||
@Shadow
|
||||
public abstract LivingEntity getControllingPassenger();
|
||||
|
||||
@Unique
|
||||
private double viaFabricPlus$speedMultiplier = 0.07D;
|
||||
|
||||
@ -84,8 +82,8 @@ public abstract class MixinBoatEntity extends VehicleEntity {
|
||||
@Unique
|
||||
private Vec3d viaFabricPlus$boatVelocity = Vec3d.ZERO;
|
||||
|
||||
public MixinBoatEntity(EntityType<?> type, World world) {
|
||||
super(type, world);
|
||||
public MixinAbstractBoatEntity(EntityType<?> entityType, World world) {
|
||||
super(entityType, world);
|
||||
}
|
||||
|
||||
@Redirect(method = "interact", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/vehicle/VehicleEntity;interact(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/ActionResult;"))
|
@ -35,7 +35,6 @@ 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.CallbackInfoReturnable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
@Mixin(EntityRenderDispatcher.class)
|
||||
public abstract class MixinEntityRenderDispatcher {
|
||||
@ -50,9 +49,9 @@ public abstract class MixinEntityRenderDispatcher {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Inject(method = "getRenderer", at = @At("HEAD"), cancellable = true)
|
||||
private <T extends Entity> void useBoatRenderer1_8(T entity, CallbackInfoReturnable<EntityRenderer<? super T>> ci) {
|
||||
private <T extends Entity> void useBoatRenderer1_8(T entity, CallbackInfoReturnable<EntityRenderer<? super T, ?>> cir) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8) && entity instanceof BoatEntity) {
|
||||
ci.setReturnValue((EntityRenderer<? super T>) viaFabricPlus$boatRenderer);
|
||||
cir.setReturnValue((EntityRenderer<? super T, ?>) viaFabricPlus$boatRenderer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,10 +25,8 @@ import net.minecraft.component.type.AttributeModifiersComponent;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ArmorItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@ -44,9 +42,9 @@ public abstract class MixinArmorItem extends Item {
|
||||
}
|
||||
|
||||
@Inject(method = "use", at = @At("HEAD"), cancellable = true)
|
||||
private void disableRightClick(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable<TypedActionResult<ItemStack>> cir) {
|
||||
private void disableRightClick(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable<ActionResult> cir) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.r1_4_6tor1_4_7)) {
|
||||
cir.setReturnValue(new TypedActionResult<>(ActionResult.FAIL, user.getStackInHand(hand)));
|
||||
cir.setReturnValue(ActionResult.FAIL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,9 +23,9 @@ import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.BowItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.consume.UseAction;
|
||||
import net.minecraft.util.ActionResult;
|
||||
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.Mixin;
|
||||
@ -51,15 +51,14 @@ public abstract class MixinBowItem {
|
||||
}
|
||||
|
||||
@Inject(method = "use", at = @At("HEAD"), cancellable = true)
|
||||
private void makeInstantUsable(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable<TypedActionResult<ItemStack>> cir) {
|
||||
private void makeInstantUsable(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable<ActionResult> cir) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(LegacyProtocolVersion.b1_7tob1_7_3)) {
|
||||
final ItemStack stack = user.getStackInHand(hand);
|
||||
final ItemStack arrowStack = user.getProjectileType(stack);
|
||||
final ItemStack arrowStack = user.getProjectileType(user.getStackInHand(hand));
|
||||
if (arrowStack.isEmpty()) {
|
||||
cir.setReturnValue(TypedActionResult.fail(stack));
|
||||
cir.setReturnValue(ActionResult.FAIL);
|
||||
} else {
|
||||
arrowStack.decrement(1);
|
||||
cir.setReturnValue(TypedActionResult.pass(stack));
|
||||
cir.setReturnValue(ActionResult.PASS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,9 +23,8 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnderPearlItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@ -36,9 +35,9 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
public abstract class MixinEnderPearlItem {
|
||||
|
||||
@Inject(method = "use", at = @At("HEAD"), cancellable = true)
|
||||
private void removeCreativeModeEnderPearl(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable<TypedActionResult<ItemStack>> ci) {
|
||||
private void removeCreativeModeEnderPearl(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable<ActionResult> ci) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8) && user.getAbilities().creativeMode) {
|
||||
ci.setReturnValue(TypedActionResult.pass(user.getStackInHand(hand)));
|
||||
ci.setReturnValue(ActionResult.PASS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,9 +23,8 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.FishingRodItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@ -36,7 +35,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
public abstract class MixinFishingRodItem {
|
||||
|
||||
@Inject(method = "use", at = @At("RETURN"))
|
||||
private void swingHand(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable<TypedActionResult<ItemStack>> cir) {
|
||||
private void swingHand(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable<ActionResult> cir) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
|
||||
user.swingHand(hand);
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item;
|
||||
|
||||
import de.florianmichael.viafabricplus.settings.impl.DebugSettings;
|
||||
import net.minecraft.entity.player.ItemCooldownManager;
|
||||
import net.minecraft.item.Item;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
@ -30,8 +29,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
@Mixin(value = ItemCooldownManager.class)
|
||||
public abstract class MixinItemCooldownManager {
|
||||
|
||||
@Inject(method = "set", at = @At("HEAD"), cancellable = true)
|
||||
private void dontSetCooldown(Item item, int duration, CallbackInfo ci) {
|
||||
@Inject(method = "set(Lnet/minecraft/util/Identifier;I)V", at = @At("HEAD"), cancellable = true)
|
||||
private void dontSetCooldown(CallbackInfo ci) {
|
||||
if (DebugSettings.global().removeCooldowns.isEnabled()) {
|
||||
ci.cancel();
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public abstract class MixinItemRenderer {
|
||||
@Final
|
||||
private ItemModels models;
|
||||
|
||||
@Inject(method = "getModel", at = @At("HEAD"), cancellable = true)
|
||||
@Inject(method = "getModel(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/World;Lnet/minecraft/entity/LivingEntity;I)Lnet/minecraft/client/render/model/BakedModel;", at = @At("HEAD"), cancellable = true)
|
||||
private void removeModel(ItemStack stack, World world, LivingEntity entity, int seed, CallbackInfoReturnable<BakedModel> cir) {
|
||||
if (VisualSettings.global().replacePetrifiedOakSlab.isEnabled() && world != null /* world is null in gui rendering */ && stack.isOf(Items.PETRIFIED_OAK_SLAB)) {
|
||||
cir.setReturnValue(this.models.getModelManager().getMissingModel());
|
||||
|
@ -38,7 +38,9 @@ import net.minecraft.item.tooltip.TooltipType;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtElement;
|
||||
import net.minecraft.nbt.NbtList;
|
||||
import net.minecraft.registry.*;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.registry.RegistryWrapper;
|
||||
import net.minecraft.registry.entry.RegistryEntry;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
@ -115,7 +117,7 @@ public abstract class MixinItemStack {
|
||||
value.ifPresent(e -> {
|
||||
final int lvl = enchantment.getInt("lvl");
|
||||
if (registryLookup != null) {
|
||||
final Optional<RegistryEntry.Reference<Enchantment>> v = registryLookup.getWrapperOrThrow(RegistryKeys.ENCHANTMENT).getOptional(e);
|
||||
final Optional<RegistryEntry.Reference<Enchantment>> v = registryLookup.getOrThrow(RegistryKeys.ENCHANTMENT).getOptional(e);
|
||||
v.ifPresent(enchantmentReference -> tooltip.accept(Enchantment.getName(enchantmentReference, MathHelper.clamp(lvl, Short.MIN_VALUE, Short.MAX_VALUE))));
|
||||
}
|
||||
});
|
||||
|
@ -22,30 +22,28 @@ 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.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.SwordItem;
|
||||
import net.minecraft.item.ToolItem;
|
||||
import net.minecraft.item.ToolMaterial;
|
||||
import net.minecraft.item.consume.UseAction;
|
||||
import net.minecraft.util.ActionResult;
|
||||
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.Mixin;
|
||||
|
||||
@Mixin(SwordItem.class)
|
||||
public abstract class MixinSwordItem extends ToolItem {
|
||||
public abstract class MixinSwordItem extends Item {
|
||||
|
||||
public MixinSwordItem(ToolMaterial material, Settings settings) {
|
||||
super(material, settings);
|
||||
public MixinSwordItem(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
|
||||
public ActionResult 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.success(itemStack);
|
||||
return ActionResult.SUCCESS;
|
||||
} else {
|
||||
return super.use(world, user, hand);
|
||||
}
|
||||
|
@ -57,7 +57,6 @@ import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
|
||||
import net.minecraft.screen.slot.SlotActionType;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
@ -74,6 +73,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@SuppressWarnings("DataFlowIssue")
|
||||
@Mixin(ClientPlayerInteractionManager.class)
|
||||
@ -114,7 +114,7 @@ public abstract class MixinClientPlayerInteractionManager implements IClientPlay
|
||||
@Inject(method = "interactItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;syncSelectedSlot()V", shift = At.Shift.AFTER))
|
||||
private void sendPlayerPosPacket(PlayerEntity player, Hand hand, CallbackInfoReturnable<ActionResult> cir) {
|
||||
if (ProtocolTranslator.getTargetVersion().betweenInclusive(ProtocolVersion.v1_17, ProtocolVersion.v1_20_5)) {
|
||||
this.networkHandler.sendPacket(new PlayerMoveC2SPacket.Full(player.getX(), player.getY(), player.getZ(), player.getYaw(), player.getPitch(), player.isOnGround()));
|
||||
this.networkHandler.sendPacket(new PlayerMoveC2SPacket.Full(player.getX(), player.getY(), player.getZ(), player.getYaw(), player.getPitch(), player.isOnGround(), player.horizontalCollision));
|
||||
}
|
||||
}
|
||||
|
||||
@ -230,21 +230,26 @@ public abstract class MixinClientPlayerInteractionManager implements IClientPlay
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "method_41929", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;use(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/TypedActionResult;"))
|
||||
private TypedActionResult<ItemStack> eitherSuccessOrPass(ItemStack instance, World world, PlayerEntity user, Hand hand, @Local ItemStack itemStack) {
|
||||
@Redirect(method = "method_41929", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;use(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/ActionResult;"))
|
||||
private ActionResult eitherSuccessOrPass(ItemStack instance, World world, PlayerEntity user, Hand hand, @Local ItemStack itemStack) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
final int count = instance.getCount();
|
||||
|
||||
final TypedActionResult<ItemStack> action = instance.use(world, user, hand);
|
||||
final ItemStack output = action.getValue();
|
||||
final ActionResult actionResult = instance.use(world, user, hand);
|
||||
final ItemStack output;
|
||||
if (actionResult instanceof ActionResult.Success success) {
|
||||
output = Objects.requireNonNullElseGet(success.getNewHandStack(), () -> user.getStackInHand(hand));
|
||||
} else {
|
||||
output = user.getStackInHand(hand);
|
||||
}
|
||||
|
||||
// In <= 1.8, ActionResult weren't a thing and interactItem simply returned either true or false
|
||||
// depending on if the input and output item are equal or not
|
||||
final boolean accepted = !output.isEmpty() && (output != itemStack || output.getCount() != count);
|
||||
if (action.getResult().isAccepted() == accepted) {
|
||||
return action;
|
||||
if (actionResult.isAccepted() == accepted) {
|
||||
return actionResult;
|
||||
} else {
|
||||
return accepted ? TypedActionResult.success(output) : TypedActionResult.pass(output);
|
||||
return accepted ? ActionResult.SUCCESS.withNewHandStack(output) : ActionResult.PASS;
|
||||
}
|
||||
} else {
|
||||
return instance.use(world, user, hand);
|
||||
|
@ -35,7 +35,7 @@ public abstract class MixinAbstractSignEditScreen {
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private SignBlockEntity blockEntity;
|
||||
protected SignBlockEntity blockEntity;
|
||||
|
||||
@Inject(method = "canEdit", at = @At("HEAD"), cancellable = true)
|
||||
private void dontCloseTooFarAwaySigns(CallbackInfoReturnable<Boolean> cir) {
|
||||
|
@ -23,32 +23,24 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.fixes.data.recipe.Recipes1_11_2;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.inventory.RecipeInputInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.recipe.CraftingRecipe;
|
||||
import net.minecraft.recipe.input.CraftingRecipeInput;
|
||||
import net.minecraft.screen.AbstractRecipeScreenHandler;
|
||||
import net.minecraft.screen.AbstractCraftingScreenHandler;
|
||||
import net.minecraft.screen.CraftingScreenHandler;
|
||||
import net.minecraft.screen.ScreenHandlerType;
|
||||
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.CallbackInfo;
|
||||
|
||||
@Mixin(CraftingScreenHandler.class)
|
||||
public abstract class MixinCraftingScreenHandler extends AbstractRecipeScreenHandler<CraftingRecipeInput, CraftingRecipe> {
|
||||
public abstract class MixinCraftingScreenHandler extends AbstractCraftingScreenHandler {
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private RecipeInputInventory input;
|
||||
|
||||
public MixinCraftingScreenHandler(ScreenHandlerType<?> screenHandlerType, int i) {
|
||||
super(screenHandlerType, i);
|
||||
public MixinCraftingScreenHandler(ScreenHandlerType<?> type, int syncId, int width, int height) {
|
||||
super(type, syncId, width, height);
|
||||
}
|
||||
|
||||
|
||||
@Redirect(method = "quickMove", at = @At(value = "INVOKE", target = "Lnet/minecraft/screen/CraftingScreenHandler;insertItem(Lnet/minecraft/item/ItemStack;IIZ)Z", ordinal = 1))
|
||||
private boolean noShiftClickMoveIntoCraftingTable(CraftingScreenHandler instance, ItemStack itemStack, int startIndex, int endIndex, boolean fromLast) {
|
||||
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_14_4) && this.insertItem(itemStack, startIndex, endIndex, fromLast);
|
||||
@ -57,7 +49,7 @@ public abstract class MixinCraftingScreenHandler extends AbstractRecipeScreenHan
|
||||
@Inject(method = "onContentChanged", at = @At("HEAD"))
|
||||
private void clientSideCrafting(Inventory inventory, CallbackInfo ci) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_11_1)) {
|
||||
Recipes1_11_2.setCraftingResultSlot(syncId, this, input);
|
||||
Recipes1_11_2.setCraftingResultSlot(syncId, this, this.craftingInventory);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,16 +23,11 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.fixes.data.recipe.Recipes1_11_2;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.inventory.RecipeInputInventory;
|
||||
import net.minecraft.recipe.CraftingRecipe;
|
||||
import net.minecraft.recipe.input.CraftingRecipeInput;
|
||||
import net.minecraft.screen.AbstractRecipeScreenHandler;
|
||||
import net.minecraft.screen.AbstractCraftingScreenHandler;
|
||||
import net.minecraft.screen.PlayerScreenHandler;
|
||||
import net.minecraft.screen.ScreenHandlerType;
|
||||
import net.minecraft.screen.slot.Slot;
|
||||
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;
|
||||
@ -40,20 +35,16 @@ import org.spongepowered.asm.mixin.injection.Slice;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(PlayerScreenHandler.class)
|
||||
public abstract class MixinPlayerScreenHandler extends AbstractRecipeScreenHandler<CraftingRecipeInput, CraftingRecipe> {
|
||||
public abstract class MixinPlayerScreenHandler extends AbstractCraftingScreenHandler {
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private RecipeInputInventory craftingInput;
|
||||
|
||||
public MixinPlayerScreenHandler(ScreenHandlerType<?> screenHandlerType, int i) {
|
||||
super(screenHandlerType, i);
|
||||
public MixinPlayerScreenHandler(ScreenHandlerType<?> type, int syncId, int width, int height) {
|
||||
super(type, syncId, width, height);
|
||||
}
|
||||
|
||||
@Inject(method = "onContentChanged", at = @At("HEAD"))
|
||||
private void clientSideCrafting(Inventory inventory, CallbackInfo ci) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_11_1)) {
|
||||
Recipes1_11_2.setCraftingResultSlot(syncId, this, craftingInput);
|
||||
Recipes1_11_2.setCraftingResultSlot(syncId, this, this.craftingInventory);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,8 +9,7 @@ accessible field net/minecraft/client/font/FontStorage$GlyphPair MISSING Lnet/mi
|
||||
accessible field net/minecraft/network/ClientConnection packetSizeLogger Lnet/minecraft/network/handler/PacketSizeLogger;
|
||||
accessible field net/minecraft/entity/boss/dragon/EnderDragonEntity body Lnet/minecraft/entity/boss/dragon/EnderDragonPart;
|
||||
accessible field net/minecraft/entity/passive/AbstractHorseEntity lastAngryAnimationProgress F
|
||||
accessible field net/minecraft/entity/vehicle/BoatEntity yawVelocity F
|
||||
accessible field net/minecraft/client/font/FontStorage glyphRendererCache Lnet/minecraft/client/font/GlyphContainer;
|
||||
accessible field net/minecraft/entity/vehicle/AbstractBoatEntity yawVelocity F
|
||||
accessible field net/minecraft/client/font/FontStorage glyphCache Lnet/minecraft/client/font/GlyphContainer;
|
||||
accessible field net/minecraft/entity/EntityType dimensions Lnet/minecraft/entity/EntityDimensions;
|
||||
accessible field net/minecraft/block/AbstractBlock velocityMultiplier F
|
||||
@ -23,7 +22,7 @@ accessible field net/minecraft/client/resource/language/TranslationStorage trans
|
||||
accessible method net/minecraft/screen/GenericContainerScreenHandler <init> (Lnet/minecraft/screen/ScreenHandlerType;ILnet/minecraft/entity/player/PlayerInventory;I)V
|
||||
accessible method net/minecraft/client/font/FontStorage$GlyphPair <init> (Lnet/minecraft/client/font/Glyph;Lnet/minecraft/client/font/Glyph;)V
|
||||
accessible method net/minecraft/entity/passive/CamelEntity getPassengerAttachmentY (ZFLnet/minecraft/entity/EntityDimensions;F)D
|
||||
accessible method net/minecraft/entity/vehicle/BoatEntity getMaxPassengers ()I
|
||||
accessible method net/minecraft/entity/vehicle/AbstractBoatEntity getMaxPassengers ()I
|
||||
accessible method net/minecraft/client/gui/screen/multiplayer/ConnectScreen setStatus (Lnet/minecraft/text/Text;)V
|
||||
accessible method net/minecraft/item/BlockItem getPlacementState (Lnet/minecraft/item/ItemPlacementContext;)Lnet/minecraft/block/BlockState;
|
||||
|
||||
|
@ -98,13 +98,13 @@
|
||||
"fixes.minecraft.block.MixinSnowBlock",
|
||||
"fixes.minecraft.block.MixinSoulSandBlock",
|
||||
"fixes.minecraft.block.MixinWallBlock",
|
||||
"fixes.minecraft.entity.MixinAbstractBoatEntity",
|
||||
"fixes.minecraft.entity.MixinAbstractClientPlayerEntity",
|
||||
"fixes.minecraft.entity.MixinAbstractHorseEntity",
|
||||
"fixes.minecraft.entity.MixinAnimalEntity",
|
||||
"fixes.minecraft.entity.MixinArmadilloEntity",
|
||||
"fixes.minecraft.entity.MixinAxolotlEntity",
|
||||
"fixes.minecraft.entity.MixinBipedEntityModel",
|
||||
"fixes.minecraft.entity.MixinBoatEntity",
|
||||
"fixes.minecraft.entity.MixinCamelEntity",
|
||||
"fixes.minecraft.entity.MixinCatEntity",
|
||||
"fixes.minecraft.entity.MixinClientPlayerEntity",
|
||||
@ -134,6 +134,7 @@
|
||||
"fixes.minecraft.item.MixinEquipment",
|
||||
"fixes.minecraft.item.MixinFireChargeItem",
|
||||
"fixes.minecraft.item.MixinFireworkRocketItem",
|
||||
"fixes.minecraft.item.MixinFishingRodItem",
|
||||
"fixes.minecraft.item.MixinHeldItemRenderer",
|
||||
"fixes.minecraft.item.MixinItemCooldownManager",
|
||||
"fixes.minecraft.item.MixinItemGroup_EntriesImpl",
|
||||
@ -187,6 +188,7 @@
|
||||
"fixes.viaversion.MixinBlockItemPacketRewriter1_20_5",
|
||||
"fixes.viaversion.MixinCommandBlockProvider",
|
||||
"fixes.viaversion.MixinCommonBoss",
|
||||
"fixes.viaversion.MixinEntityPacketRewriter1_12",
|
||||
"fixes.viaversion.MixinEntityPacketRewriter1_15",
|
||||
"fixes.viaversion.MixinEntityPacketRewriter1_17",
|
||||
"fixes.viaversion.MixinEntityPacketRewriter1_19_4",
|
||||
@ -203,7 +205,6 @@
|
||||
"fixes.viaversion.MixinParticleIdMappings1_13",
|
||||
"fixes.viaversion.MixinParticleMappings",
|
||||
"fixes.viaversion.MixinProtocol1_10To1_11",
|
||||
"fixes.viaversion.MixinEntityPacketRewriter1_12",
|
||||
"fixes.viaversion.MixinProtocol1_20_3To1_20_5",
|
||||
"fixes.viaversion.MixinProtocol1_20To1_20_2",
|
||||
"fixes.viaversion.MixinTagType",
|
||||
@ -213,8 +214,7 @@
|
||||
"fixes.viaversion.MixinWorldPacketRewriter1_19",
|
||||
"viabedrock.MixinJoinPackets",
|
||||
"vialegacy.MixinExtensionProtocolMetadataStorage",
|
||||
"vialegacy.MixinViaLegacyConfig",
|
||||
"fixes.minecraft.item.MixinFishingRodItem"
|
||||
"vialegacy.MixinViaLegacyConfig"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
Loading…
Reference in New Issue
Block a user