Skip to content

Commit

Permalink
fix: better solution
Browse files Browse the repository at this point in the history
  • Loading branch information
Zepalesque committed Jan 1, 2025
1 parent c566ef8 commit c581325
Showing 1 changed file with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
package net.zepalesque.zenith.core.tile;

import net.minecraft.core.BlockPos;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.entity.HangingSignBlockEntity;
import net.minecraft.world.level.block.entity.SignBlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.zepalesque.zenith.api.blockset.type.AbstractWoodSet;

import java.util.function.Supplier;

public class ZenithHangingSignBlockEntity extends HangingSignBlockEntity {
protected final AbstractWoodSet woodset;
public class ZenithHangingSignBlockEntity extends SignBlockEntity {
private static final int MAX_TEXT_LINE_WIDTH = 60;
private static final int TEXT_LINE_HEIGHT = 9;

protected <T extends AbstractWoodSet> ZenithHangingSignBlockEntity(BlockPos pos, BlockState state, T woodset) {
super(pos, state);
this.woodset = woodset;
public ZenithHangingSignBlockEntity(BlockPos pos, BlockState state, Supplier<BlockEntityType<? extends ZenithHangingSignBlockEntity>> type) {
super(type.get(), pos, state);
}

// Fix to get around crashing caused by the validateBlockState method
public static <T extends AbstractWoodSet> ZenithHangingSignBlockEntity create(BlockPos pos, BlockState state, T set) {
return new ZenithHangingSignBlockEntity(pos, state, set) {
@Override
public BlockEntityType<? extends ZenithHangingSignBlockEntity> getType() {
return this.woodset == null ? set.hangingSignEntity().get() : this.woodset.hangingSignEntity().get();
}
};
public int getTextLineHeight() {
return TEXT_LINE_HEIGHT;
}

@Override
public BlockEntityType<? extends ZenithHangingSignBlockEntity> getType() {
return this.woodset.hangingSignEntity().get();
public int getMaxTextLineWidth() {
return MAX_TEXT_LINE_WIDTH;
}

public SoundEvent getSignInteractionFailedSoundEvent() {
return SoundEvents.WAXED_HANGING_SIGN_INTERACT_FAIL;
}
}

0 comments on commit c581325

Please sign in to comment.