Skip to content

Commit

Permalink
Fix sign properties being incorrect, prepare for additional sign atta…
Browse files Browse the repository at this point in the history
…chments
  • Loading branch information
Vazkii committed Dec 4, 2023
1 parent 21a9ea5 commit 63c7dfd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ public static WoodSet addWoodSet(ZRegister event, ZetaModule module, String name

((IZetaBlock) set.log).setCreativeTab(CreativeModeTabs.NATURAL_BLOCKS, Blocks.WARPED_STEM, false);

set.sign = new ZetaStandingSignBlock(name + "_sign", module, type, OldMaterials.wood().mapColor(color).noCollission().strength(1.0F).sound(SoundType.WOOD));
set.wallSign = new ZetaWallSignBlock(name + "_wall_sign", module, type, OldMaterials.wood().mapColor(color).noCollission().strength(1.0F).sound(SoundType.WOOD).lootFrom(() -> set.sign));
set.sign = new ZetaStandingSignBlock(name + "_sign", module, type, OldMaterials.wood().forceSolidOn().mapColor(color).noCollission().strength(1.0F).sound(SoundType.WOOD));
set.wallSign = new ZetaWallSignBlock(name + "_wall_sign", module, type, OldMaterials.wood().forceSolidOn().mapColor(color).noCollission().strength(1.0F).sound(SoundType.WOOD).lootFrom(() -> set.sign));

set.ceilingHangingSign = new ZetaCeilingHangingSignBlock(name + "_hanging_sign", module, type, OldMaterials.wood().mapColor(color).noCollission().strength(1.0F).sound(SoundType.WOOD));
set.wallHangingSign = new ZetaWallHangingSignBlock(name + "_wall_hanging_sign", module, type, OldMaterials.wood().mapColor(color).noCollission().strength(1.0F).sound(SoundType.WOOD).lootFrom(() -> set.sign));
set.ceilingHangingSign = new ZetaCeilingHangingSignBlock(name + "_hanging_sign", module, type, OldMaterials.wood().forceSolidOn().mapColor(color).noCollission().strength(1.0F).sound(SoundType.WOOD));
set.wallHangingSign = new ZetaWallHangingSignBlock(name + "_wall_hanging_sign", module, type, OldMaterials.wood().forceSolidOn().mapColor(color).noCollission().strength(1.0F).sound(SoundType.WOOD).lootFrom(() -> set.sign));

set.bookshelf = new VariantBookshelfBlock(name, module, true).setCondition(() -> Quark.ZETA.modules.isEnabledOrOverlapping(VariantBookshelvesModule.class));
set.ladder = new VariantLadderBlock(name, module, true).setCondition(() -> Quark.ZETA.modules.isEnabledOrOverlapping(VariantLaddersModule.class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,17 @@ public class GlassItemFrame extends ItemFrame implements IEntityAdditionalSpawnD
private static final GameProfile DUMMY_PROFILE = new GameProfile(UUID.randomUUID(), "ItemFrame");

private boolean didHackery = false;
private Integer onSignRotation = null; //not on sign
private int onSignRotation = 0;
private SignAttachment attachment = SignAttachment.NOT_ATTACHED;

public enum SignAttachment {
NOT_ATTACHED,
STANDING_IN_FRONT,
STANDING_BEHIND,
WALL,
HANGING_IN_FRONT,
HANGING_BEHIND
}

public GlassItemFrame(EntityType<? extends GlassItemFrame> type, Level worldIn) {
super(type, worldIn);
Expand Down Expand Up @@ -110,10 +120,12 @@ public void tick() {
}

private void updateIsOnSign() {
onSignRotation = null;
attachment = SignAttachment.NOT_ATTACHED;

if(this.direction.getAxis() != Direction.Axis.Y){
BlockState back = level().getBlockState(getBehindPos());
if(back.is(BlockTags.STANDING_SIGNS)){
if(back.is(BlockTags.STANDING_SIGNS)) {
attachment = SignAttachment.STANDING_IN_FRONT;
onSignRotation = back.getValue(StandingSignBlock.ROTATION);
}
}
Expand All @@ -135,11 +147,15 @@ public BlockPos getBehindPos() {
return pos.relative(direction.getOpposite());
}

public SignAttachment getSignAttachment() {
return attachment;
}

public boolean isOnSign() {
return onSignRotation != null;
return getSignAttachment() != SignAttachment.NOT_ATTACHED;
}

public Integer getOnSignRotation(){
public int getOnSignRotation(){
return onSignRotation;
}

Expand Down

0 comments on commit 63c7dfd

Please sign in to comment.