mirror of
https://github.com/architectury/architectury-api.git
synced 2026-03-28 03:56:59 -05:00
Fix BlockEntityExtension @Shadow remapping
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
plugins {
|
||||
id "architectury-plugin" version "3.0.89"
|
||||
id "forgified-fabric-loom" version "0.6.70" apply false
|
||||
id "forgified-fabric-loom" version "0.6.71" apply false
|
||||
id "org.cadixdev.licenser" version "0.5.0"
|
||||
id "com.matthewprenger.cursegradle" version "1.4.0" apply false
|
||||
id "maven-publish"
|
||||
|
||||
@@ -24,20 +24,10 @@ import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
@Mixin(BlockEntityExtension.class)
|
||||
public interface MixinBlockEntityExtension extends BlockEntityClientSerializable {
|
||||
@Shadow(remap = false)
|
||||
@NotNull
|
||||
CompoundTag saveClientData(@NotNull CompoundTag tag);
|
||||
|
||||
@Shadow(remap = false)
|
||||
void loadClientData(@NotNull BlockState pos, @NotNull CompoundTag tag);
|
||||
|
||||
@Override
|
||||
default void fromClientTag(CompoundTag tag) {
|
||||
BlockEntity entity = (BlockEntity) this;
|
||||
@@ -45,12 +35,12 @@ public interface MixinBlockEntityExtension extends BlockEntityClientSerializable
|
||||
if (tag.contains("x") && tag.contains("y") && tag.contains("z")) {
|
||||
entity.setLevelAndPosition(entity.getLevel(), new BlockPos(tag.getInt("x"), tag.getInt("y"), tag.getInt("z")));
|
||||
}
|
||||
loadClientData(entity.getBlockState(), tag);
|
||||
((BlockEntityExtension) this).loadClientData(entity.getBlockState(), tag);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
default CompoundTag toClientTag(CompoundTag tag) {
|
||||
return saveClientData(tag);
|
||||
return ((BlockEntityExtension) this).saveClientData(tag);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,22 +26,17 @@ import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.common.extensions.IForgeTileEntity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
@Mixin(BlockEntityExtension.class)
|
||||
public interface MixinBlockEntityExtension extends IForgeTileEntity {
|
||||
@Shadow(remap = false)
|
||||
void loadClientData(@NotNull BlockState pos, @NotNull CompoundTag tag);
|
||||
|
||||
@Override
|
||||
default void handleUpdateTag(BlockState state, CompoundTag tag) {
|
||||
loadClientData(state, tag);
|
||||
((BlockEntityExtension) this).loadClientData(state, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
default void onDataPacket(Connection connection, ClientboundBlockEntityDataPacket packet) {
|
||||
loadClientData(((BlockEntity) this).getBlockState(), packet.getTag());
|
||||
((BlockEntityExtension) this).loadClientData(((BlockEntity) this).getBlockState(), packet.getTag());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user