Some Sign-Related changes (have to rework Signs for the new 1.20 mechanics)
This commit is contained in:
parent
145e6168c3
commit
465497db9a
2 changed files with 14 additions and 9 deletions
|
@ -28,10 +28,7 @@ import net.minecraft.world.level.block.*;
|
||||||
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.minecraft.world.level.block.state.StateDefinition;
|
import net.minecraft.world.level.block.state.StateDefinition;
|
||||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
import net.minecraft.world.level.block.state.properties.*;
|
||||||
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
|
||||||
import net.minecraft.world.level.block.state.properties.IntegerProperty;
|
|
||||||
import net.minecraft.world.level.block.state.properties.WoodType;
|
|
||||||
import net.minecraft.world.level.material.Fluid;
|
import net.minecraft.world.level.material.Fluid;
|
||||||
import net.minecraft.world.level.material.FluidState;
|
import net.minecraft.world.level.material.FluidState;
|
||||||
import net.minecraft.world.level.material.Fluids;
|
import net.minecraft.world.level.material.Fluids;
|
||||||
|
@ -83,6 +80,11 @@ public class BaseSignBlock extends SignBlock implements BlockModelProvider, Cust
|
||||||
return new BaseSignBlockEntity(blockPos, blockState);
|
return new BaseSignBlockEntity(blockPos, blockState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getYRotationDegrees(BlockState blockState) {
|
||||||
|
return RotationSegment.convertToDegrees(blockState.getValue(ROTATION));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPlacedBy(Level world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) {
|
public void setPlacedBy(Level world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) {
|
||||||
if (placer instanceof Player) {
|
if (placer instanceof Player) {
|
||||||
|
@ -90,9 +92,9 @@ public class BaseSignBlock extends SignBlock implements BlockModelProvider, Cust
|
||||||
if (sign != null) {
|
if (sign != null) {
|
||||||
if (!world.isClientSide) {
|
if (!world.isClientSide) {
|
||||||
sign.setAllowedPlayerEditor(placer.getUUID());
|
sign.setAllowedPlayerEditor(placer.getUUID());
|
||||||
((ServerPlayer) placer).connection.send(new ClientboundOpenSignEditorPacket(pos));
|
((ServerPlayer) placer).connection.send(new ClientboundOpenSignEditorPacket(pos, true));
|
||||||
} else {
|
} else {
|
||||||
sign.setEditable(true);
|
//sign.setEditable(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
@Mixin(SignEditScreen.class)
|
@Mixin(SignEditScreen.class)
|
||||||
public abstract class SignEditScreenMixin extends AbstractSignEditScreen {
|
public abstract class SignEditScreenMixin extends AbstractSignEditScreen {
|
||||||
|
@Shadow
|
||||||
|
private final SignBlockEntity sign;
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
private SignRenderer.SignModel signModel;
|
private SignRenderer.SignModel signModel;
|
||||||
|
@ -31,8 +33,9 @@ public abstract class SignEditScreenMixin extends AbstractSignEditScreen {
|
||||||
@Unique
|
@Unique
|
||||||
private boolean bclib_isSign;
|
private boolean bclib_isSign;
|
||||||
|
|
||||||
public SignEditScreenMixin(SignBlockEntity signBlockEntity, boolean bl) {
|
public SignEditScreenMixin(SignBlockEntity signBlockEntity, boolean bl, boolean bl2) {
|
||||||
super(signBlockEntity, bl);
|
super(signBlockEntity, bl, bl2);
|
||||||
|
sign = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,7 +54,7 @@ public abstract class SignEditScreenMixin extends AbstractSignEditScreen {
|
||||||
private VertexConsumer bclib_renderSignBackground(VertexConsumer consumer) {
|
private VertexConsumer bclib_renderSignBackground(VertexConsumer consumer) {
|
||||||
if (bclib_isSign) {
|
if (bclib_isSign) {
|
||||||
signModel.stick.visible = bclib_renderStick;
|
signModel.stick.visible = bclib_renderStick;
|
||||||
Block block = sign.getBlockState().getBlock();
|
Block block = this.sign.getBlockState().getBlock();
|
||||||
MultiBufferSource.BufferSource bufferSource = this.minecraft.renderBuffers().bufferSource();
|
MultiBufferSource.BufferSource bufferSource = this.minecraft.renderBuffers().bufferSource();
|
||||||
return BaseSignBlockEntityRenderer.getConsumer(bufferSource, block);
|
return BaseSignBlockEntityRenderer.getConsumer(bufferSource, block);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue