Skip to content

Commit 9ed6768

Browse files
committed
UD-260119
1 parent 464f196 commit 9ed6768

28 files changed

Lines changed: 401 additions & 168 deletions

src/generated/resources/data/mia/worldgen/noise_settings/the_abyss.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -485,11 +485,11 @@
485485
"type": "minecraft:condition",
486486
"if_true": {
487487
"type": "minecraft:y_above",
488-
"add_stone_depth": true,
488+
"add_stone_depth": false,
489489
"anchor": {
490490
"absolute": 320
491491
},
492-
"surface_depth_multiplier": -1
492+
"surface_depth_multiplier": 0
493493
},
494494
"then_run": {
495495
"type": "minecraft:condition",
@@ -530,7 +530,7 @@
530530
"type": "minecraft:y_above",
531531
"add_stone_depth": false,
532532
"anchor": {
533-
"absolute": 288
533+
"absolute": 291
534534
},
535535
"surface_depth_multiplier": 0
536536
}
@@ -547,11 +547,11 @@
547547
"type": "minecraft:condition",
548548
"if_true": {
549549
"type": "minecraft:y_above",
550-
"add_stone_depth": true,
550+
"add_stone_depth": false,
551551
"anchor": {
552552
"absolute": 256
553553
},
554-
"surface_depth_multiplier": -1
554+
"surface_depth_multiplier": 0
555555
},
556556
"then_run": {
557557
"type": "minecraft:condition",
@@ -578,11 +578,11 @@
578578
"type": "minecraft:condition",
579579
"if_true": {
580580
"type": "minecraft:y_above",
581-
"add_stone_depth": false,
581+
"add_stone_depth": true,
582582
"anchor": {
583583
"absolute": 192
584584
},
585-
"surface_depth_multiplier": 0
585+
"surface_depth_multiplier": -1
586586
},
587587
"then_run": {
588588
"type": "minecraft:condition",
@@ -592,7 +592,7 @@
592592
"type": "minecraft:y_above",
593593
"add_stone_depth": false,
594594
"anchor": {
595-
"absolute": 195
595+
"absolute": 192
596596
},
597597
"surface_depth_multiplier": 0
598598
}
@@ -609,11 +609,11 @@
609609
"type": "minecraft:condition",
610610
"if_true": {
611611
"type": "minecraft:y_above",
612-
"add_stone_depth": true,
612+
"add_stone_depth": false,
613613
"anchor": {
614614
"absolute": 128
615615
},
616-
"surface_depth_multiplier": -1
616+
"surface_depth_multiplier": 0
617617
},
618618
"then_run": {
619619
"type": "minecraft:condition",
@@ -654,7 +654,7 @@
654654
"type": "minecraft:y_above",
655655
"add_stone_depth": false,
656656
"anchor": {
657-
"absolute": 64
657+
"absolute": 67
658658
},
659659
"surface_depth_multiplier": 0
660660
}
@@ -671,11 +671,11 @@
671671
"type": "minecraft:condition",
672672
"if_true": {
673673
"type": "minecraft:y_above",
674-
"add_stone_depth": true,
674+
"add_stone_depth": false,
675675
"anchor": {
676676
"absolute": 48
677677
},
678-
"surface_depth_multiplier": -1
678+
"surface_depth_multiplier": 0
679679
},
680680
"then_run": {
681681
"type": "minecraft:condition",
@@ -685,7 +685,7 @@
685685
"type": "minecraft:y_above",
686686
"add_stone_depth": false,
687687
"anchor": {
688-
"absolute": 49
688+
"absolute": 50
689689
},
690690
"surface_depth_multiplier": 0
691691
}

src/generated/resources/data/mia/worldgen/structure_set/abyss_strongholds.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"placement": {
33
"type": "minecraft:concentric_rings",
4-
"count": 128,
5-
"distance": 16,
4+
"count": 64,
5+
"distance": 32,
66
"preferred_biomes": "#minecraft:is_overworld",
77
"salt": 0,
8-
"spread": 3
8+
"spread": 12
99
},
1010
"structures": [
1111
{

src/main/java/com/altnoir/mia/block/AbyssPortalBlock.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public void animateTick(BlockState state, Level level, BlockPos pos, RandomSourc
197197
d5 = (double) (random.nextFloat() * 2.0F * (float) j);
198198
}
199199

200-
level.addParticle(ParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5);
200+
level.addParticle(ParticleTypes.GLOW, d0, d1, d2, d3, d4, d5);
201201
}
202202
}
203203

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package com.altnoir.mia.block;
22

3+
import com.altnoir.mia.init.MiaBlocks;
34
import com.altnoir.mia.init.MiaItems;
45
import com.altnoir.mia.worldgen.feature.AbyssPortalFeature;
56
import net.minecraft.core.BlockPos;
67
import net.minecraft.server.level.ServerLevel;
8+
import net.minecraft.util.RandomSource;
79
import net.minecraft.world.InteractionHand;
810
import net.minecraft.world.ItemInteractionResult;
911
import net.minecraft.world.entity.player.Player;
@@ -14,36 +16,65 @@
1416
import net.minecraft.world.level.block.state.BlockState;
1517
import net.minecraft.world.level.block.state.StateDefinition;
1618
import net.minecraft.world.level.block.state.properties.BooleanProperty;
19+
import net.minecraft.world.level.block.state.properties.IntegerProperty;
1720
import net.minecraft.world.phys.BlockHitResult;
1821

1922
public class AbyssPortalFrameBlock extends Block {
2023
public static final BooleanProperty COMPASS = BooleanProperty.create("compass");
24+
public static final IntegerProperty STAGE = IntegerProperty.create("stage", 0, 5);
2125

2226
public AbyssPortalFrameBlock(Properties properties) {
2327
super(properties);
24-
this.registerDefaultState(this.stateDefinition.any().setValue(COMPASS, Boolean.valueOf(false)));
28+
this.registerDefaultState(this.stateDefinition.any()
29+
.setValue(COMPASS, Boolean.valueOf(false))
30+
.setValue(STAGE, 0));
2531
}
2632

2733
@Override
2834
protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) {
2935
if (stack.is(MiaItems.STAR_COMPASS.get()) && !state.getValue(COMPASS) && level.dimension() == Level.OVERWORLD) {
3036
if (!level.isClientSide()) {
31-
level.setBlock(pos, state.setValue(COMPASS, Boolean.valueOf(true)), 3);
37+
level.setBlock(pos, state.setValue(COMPASS, Boolean.valueOf(true)).setValue(STAGE, 0), 3);
3238
level.levelEvent(1503, pos, 0);
3339

34-
ServerLevel serverLevel = level.getServer().getLevel(Level.OVERWORLD);
35-
BlockPos targetPos = pos.below(7);
36-
AbyssPortalFeature.createPortalStructure(serverLevel, targetPos, 5, 8, true);
37-
38-
level.globalLevelEvent(1038, targetPos, 0);
40+
level.scheduleTick(pos, this, 20);
3941
}
4042
}
4143
return super.useItemOn(stack, state, level, pos, player, hand, hitResult);
4244
}
4345

46+
@Override
47+
protected void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
48+
if (!state.getValue(COMPASS)) {
49+
return;
50+
}
51+
52+
int newStage = state.getValue(STAGE) + 1;
53+
54+
if (newStage > 5 || newStage < 1) {
55+
return;
56+
}
57+
level.setBlock(pos, state.setValue(STAGE, newStage), 3);
58+
59+
ServerLevel serverLevel = level.getServer().getLevel(Level.OVERWORLD);
60+
BlockPos targetPos = pos.below(7);
61+
62+
if (newStage < 5) {
63+
int height = 5 - newStage;
64+
AbyssPortalFeature.createPortalStructure(serverLevel, targetPos, height);
65+
} else {
66+
AbyssPortalFeature.createPortalStructure(serverLevel, targetPos, MiaBlocks.ABYSS_PORTAL.get(), 0);
67+
level.globalLevelEvent(1038, targetPos, 0);
68+
return;
69+
}
70+
level.scheduleTick(pos, this, 20);
71+
}
72+
4473
@Override
4574
public BlockState getStateForPlacement(BlockPlaceContext context) {
46-
return this.defaultBlockState().setValue(COMPASS, Boolean.valueOf(false));
75+
return this.defaultBlockState()
76+
.setValue(COMPASS, Boolean.valueOf(false))
77+
.setValue(STAGE, 0);
4778
}
4879

4980
@Override
@@ -58,6 +89,6 @@ protected int getAnalogOutputSignal(BlockState blockState, Level level, BlockPos
5889

5990
@Override
6091
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
61-
builder.add(COMPASS);
92+
builder.add(COMPASS, STAGE);
6293
}
63-
}
94+
}

src/main/java/com/altnoir/mia/block/AbyssSpawnerBlock.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, Block
6262
return level instanceof ServerLevel serverlevel
6363
? createTickerHelper(
6464
entityType,
65-
MiaBlockEntities.ABYSS_SPAWNER_BLOCK_ENTITY.get(),
65+
MiaBlockEntities.ABYSS_SPAWNER_ENTITY.get(),
6666
(blockLevel, blockPos, blockState, e) -> e.getAbyssSpawner()
6767
.tickServer(serverlevel, blockPos, blockState.getOptionalValue(BlockStateProperties.OMINOUS).orElse(false))
6868
)
6969
: createTickerHelper(
7070
entityType,
71-
MiaBlockEntities.ABYSS_SPAWNER_BLOCK_ENTITY.get(),
71+
MiaBlockEntities.ABYSS_SPAWNER_ENTITY.get(),
7272
(blockLevel, blockPos, blockState, e) -> e.getAbyssSpawner()
7373
.tickClient(blockLevel, blockPos, blockState.getOptionalValue(BlockStateProperties.OMINOUS).orElse(false))
7474
);
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.altnoir.mia.block;
2+
3+
import com.altnoir.mia.block.entity.CaveExplorerBeaconBlockEntity;
4+
import com.altnoir.mia.init.MiaBlockEntities;
5+
import com.mojang.serialization.MapCodec;
6+
import net.minecraft.core.BlockPos;
7+
import net.minecraft.world.level.Level;
8+
import net.minecraft.world.level.block.BaseEntityBlock;
9+
import net.minecraft.world.level.block.RenderShape;
10+
import net.minecraft.world.level.block.entity.BlockEntity;
11+
import net.minecraft.world.level.block.entity.BlockEntityTicker;
12+
import net.minecraft.world.level.block.entity.BlockEntityType;
13+
import net.minecraft.world.level.block.state.BlockState;
14+
import org.jetbrains.annotations.Nullable;
15+
16+
public class CaveExplorerBeaconBlock extends BaseEntityBlock {
17+
public static final MapCodec<CaveExplorerBeaconBlock> CODEC = simpleCodec(CaveExplorerBeaconBlock::new);
18+
public CaveExplorerBeaconBlock(Properties properties) {
19+
super(properties);
20+
}
21+
22+
@Override
23+
protected MapCodec<? extends BaseEntityBlock> codec() {
24+
return CODEC;
25+
}
26+
27+
@Override
28+
public @Nullable BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
29+
return new CaveExplorerBeaconBlockEntity(pos,state);
30+
}
31+
32+
@Override
33+
public @Nullable <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> blockEntityType) {
34+
return createTickerHelper(blockEntityType, MiaBlockEntities.CAVE_EXPLORER_BEACON_ENTITY.get(), CaveExplorerBeaconBlockEntity::tick);
35+
}
36+
37+
@Override
38+
protected RenderShape getRenderShape(BlockState state) {
39+
return RenderShape.MODEL;
40+
}
41+
}

src/main/java/com/altnoir/mia/block/EndlessCupBlock.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,6 @@ protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Lev
102102
@Nullable
103103
@Override
104104
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> blockEntityType) {
105-
return level.isClientSide() ? null : createTickerHelper(blockEntityType, MiaBlockEntities.ENDLESS_CUP_BLOCK_ENTITY.get(), EndlessCupBlockEntity::tick);
105+
return level.isClientSide() ? null : createTickerHelper(blockEntityType, MiaBlockEntities.ENDLESS_CUP_ENTITY.get(), EndlessCupBlockEntity::tick);
106106
}
107107
}

src/main/java/com/altnoir/mia/block/entity/AbyssSpawnerBlockEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class AbyssSpawnerBlockEntity extends BlockEntity implements AbyssTrialSp
2424
private AbyssTrialSpawnerPattern cachedPattern;
2525

2626
public AbyssSpawnerBlockEntity(BlockPos pos, BlockState state) {
27-
super(MiaBlockEntities.ABYSS_SPAWNER_BLOCK_ENTITY.get(), pos, state);
27+
super(MiaBlockEntities.ABYSS_SPAWNER_ENTITY.get(), pos, state);
2828
this.abyssSpawner = new AbyssTrialSpawner(this);
2929
}
3030

0 commit comments

Comments
 (0)