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 {
|
plugins {
|
||||||
id "architectury-plugin" version "3.0.89"
|
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 "org.cadixdev.licenser" version "0.5.0"
|
||||||
id "com.matthewprenger.cursegradle" version "1.4.0" apply false
|
id "com.matthewprenger.cursegradle" version "1.4.0" apply false
|
||||||
id "maven-publish"
|
id "maven-publish"
|
||||||
|
|||||||
@@ -24,20 +24,10 @@ import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable;
|
|||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
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.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
|
|
||||||
@Mixin(BlockEntityExtension.class)
|
@Mixin(BlockEntityExtension.class)
|
||||||
public interface MixinBlockEntityExtension extends BlockEntityClientSerializable {
|
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
|
@Override
|
||||||
default void fromClientTag(CompoundTag tag) {
|
default void fromClientTag(CompoundTag tag) {
|
||||||
BlockEntity entity = (BlockEntity) this;
|
BlockEntity entity = (BlockEntity) this;
|
||||||
@@ -45,12 +35,12 @@ public interface MixinBlockEntityExtension extends BlockEntityClientSerializable
|
|||||||
if (tag.contains("x") && tag.contains("y") && tag.contains("z")) {
|
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")));
|
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
|
@Override
|
||||||
default CompoundTag toClientTag(CompoundTag tag) {
|
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.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraftforge.common.extensions.IForgeTileEntity;
|
import net.minecraftforge.common.extensions.IForgeTileEntity;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
|
|
||||||
@Mixin(BlockEntityExtension.class)
|
@Mixin(BlockEntityExtension.class)
|
||||||
public interface MixinBlockEntityExtension extends IForgeTileEntity {
|
public interface MixinBlockEntityExtension extends IForgeTileEntity {
|
||||||
@Shadow(remap = false)
|
|
||||||
void loadClientData(@NotNull BlockState pos, @NotNull CompoundTag tag);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default void handleUpdateTag(BlockState state, CompoundTag tag) {
|
default void handleUpdateTag(BlockState state, CompoundTag tag) {
|
||||||
loadClientData(state, tag);
|
((BlockEntityExtension) this).loadClientData(state, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default void onDataPacket(Connection connection, ClientboundBlockEntityDataPacket packet) {
|
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