Skip to content

Commit 36d26af

Browse files
committed
Crystals 1.2.3 Release
Patch generation crash issue Patched icon on metadata for NeoForge Tweaks crystals generation
1 parent c8cf070 commit 36d26af

File tree

11 files changed

+41
-86
lines changed

11 files changed

+41
-86
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[Architectury Transformer DEBUG] Closed File Systems for /home/killar/projects/java/Crystals/common/build/libs/common-1.2.3.jar

common/src/main/java/github/killarexe/crystals/worldgen/feature/CrystalFeature.java

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
import net.minecraft.core.Direction;
1010
import net.minecraft.util.RandomSource;
1111
import net.minecraft.world.level.WorldGenLevel;
12-
import net.minecraft.world.level.block.Block;
12+
import net.minecraft.world.level.block.Blocks;
13+
import net.minecraft.world.level.block.state.BlockState;
1314
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
1415
import net.minecraft.world.level.levelgen.feature.Feature;
1516
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
@@ -27,48 +28,37 @@ public boolean place(FeaturePlaceContext<CrystalFeatureConfig> featurePlaceConte
2728
WorldGenLevel level = featurePlaceContext.level();
2829
CrystalFeatureConfig config = featurePlaceContext.config();
2930
BlockPos origin = featurePlaceContext.origin();
30-
3131
TargetBlockState targetBlockState = config.target();
32-
3332
RandomSource random = level.getRandom();
34-
35-
if(!level.getBlockState(origin).isAir()) {
33+
BlockState currentState = level.getBlockState(origin);
34+
boolean isWaterLogged = currentState.is(Blocks.WATER);
35+
36+
if(!(currentState.isAir() || isWaterLogged)) {
3637
return false;
3738
}
38-
39+
3940
Optional<Direction> direction = getDirection(origin, targetBlockState, level, random);
4041
if(direction.isPresent()) {
41-
try {
42-
level.setBlock(origin, targetBlockState.state.setValue(BlockStateProperties.FACING, direction.get()), Block.UPDATE_ALL_IMMEDIATE);
43-
return true;
44-
}catch (Exception e) {
45-
e.printStackTrace();
46-
}
42+
level.setBlock(origin, targetBlockState.state.setValue(BlockStateProperties.FACING, direction.get()).setValue(BlockStateProperties.WATERLOGGED, isWaterLogged), 3);
43+
level.getChunk(origin).markPosForPostprocessing(origin);
44+
return true;
4745
}
4846
return false;
4947
}
50-
48+
5149
private Optional<Direction> getDirection(BlockPos origin, TargetBlockState targetBlockState, WorldGenLevel level, RandomSource source) {
52-
ArrayList<Direction> availableDirections = new ArrayList<Direction>();
50+
ArrayList<Direction> availableDirections = new ArrayList<>();
5351
RuleTest rule = targetBlockState.target;
54-
if(rule.test(level.getBlockState(origin.north()), source)) {
55-
availableDirections.add(Direction.SOUTH);
56-
}
57-
if(rule.test(level.getBlockState(origin.south()), source)) {
58-
availableDirections.add(Direction.NORTH);
59-
}
60-
if(rule.test(level.getBlockState(origin.west()), source)) {
61-
availableDirections.add(Direction.EAST);
62-
}
63-
if(rule.test(level.getBlockState(origin.east()), source)) {
64-
availableDirections.add(Direction.WEST);
65-
}
66-
if(rule.test(level.getBlockState(origin.above()), source)) {
67-
availableDirections.add(Direction.DOWN);
68-
}
69-
if(rule.test(level.getBlockState(origin.below()), source)) {
70-
availableDirections.add(Direction.UP);
52+
53+
for (Direction direction : Direction.values()) {
54+
BlockPos adjacentPos = origin.relative(direction);
55+
if (level.hasChunkAt(adjacentPos)) {
56+
if (rule.test(level.getBlockState(adjacentPos), source)) {
57+
availableDirections.add(direction.getOpposite());
58+
}
59+
}
7160
}
61+
7262
if(availableDirections.isEmpty()) {
7363
return Optional.empty();
7464
}

common/src/main/resources/data/crystals/worldgen/placed_feature/diamond_crystals.json

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"height": {
77
"type": "minecraft:uniform",
88
"min_inclusive": {
9-
"above_bottom": -63
9+
"absolute": -63
1010
},
1111
"max_inclusive": {
1212
"absolute": 16
@@ -15,14 +15,7 @@
1515
},
1616
{
1717
"type": "minecraft:count_on_every_layer",
18-
"count": {
19-
"type": "minecraft:uniform",
20-
"min_inclusive": 191,
21-
"max_inclusive": 255
22-
}
23-
},
24-
{
25-
"type": "minecraft:in_square"
18+
"count": 15
2619
},
2720
{
2821
"type": "minecraft:biome"

common/src/main/resources/data/crystals/worldgen/placed_feature/emerald_crystals.json

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,13 @@
99
"above_bottom": 19
1010
},
1111
"max_inclusive": {
12-
"absolute": 128
12+
"absolute": 127
1313
}
1414
}
1515
},
1616
{
1717
"type": "minecraft:count_on_every_layer",
18-
"count": {
19-
"type": "minecraft:uniform",
20-
"min_inclusive": 191,
21-
"max_inclusive": 255
22-
}
23-
},
24-
{
25-
"type": "minecraft:in_square"
18+
"count": 15
2619
},
2720
{
2821
"type": "minecraft:biome"

common/src/main/resources/data/crystals/worldgen/placed_feature/glowstone_crystals.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,7 @@
1515
},
1616
{
1717
"type": "minecraft:count_on_every_layer",
18-
"count": {
19-
"type": "minecraft:uniform",
20-
"min_inclusive": 223,
21-
"max_inclusive": 255
22-
}
23-
},
24-
{
25-
"type": "minecraft:in_square"
18+
"count": 30
2619
},
2720
{
2821
"type": "minecraft:biome"

common/src/main/resources/data/crystals/worldgen/placed_feature/lapis_crystals.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,7 @@
1515
},
1616
{
1717
"type": "minecraft:count_on_every_layer",
18-
"count": {
19-
"type": "minecraft:uniform",
20-
"min_inclusive": 223,
21-
"max_inclusive": 255
22-
}
23-
},
24-
{
25-
"type": "minecraft:in_square"
18+
"count": 15
2619
},
2720
{
2821
"type": "minecraft:biome"

common/src/main/resources/data/crystals/worldgen/placed_feature/quartz_crystals.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,7 @@
1515
},
1616
{
1717
"type": "minecraft:count_on_every_layer",
18-
"count": {
19-
"type": "minecraft:uniform",
20-
"min_inclusive": 223,
21-
"max_inclusive": 255
22-
}
23-
},
24-
{
25-
"type": "minecraft:in_square"
18+
"count": 30
2619
},
2720
{
2821
"type": "minecraft:biome"

common/src/main/resources/data/crystals/worldgen/placed_feature/redstone_crystals.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,7 @@
1515
},
1616
{
1717
"type": "minecraft:count_on_every_layer",
18-
"count": {
19-
"type": "minecraft:uniform",
20-
"min_inclusive": 191,
21-
"max_inclusive": 255
22-
}
23-
},
24-
{
25-
"type": "minecraft:in_square"
18+
"count": 15
2619
},
2720
{
2821
"type": "minecraft:biome"

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ enabled_platforms=fabric,neoforge
88
minecraft_version=1.21
99

1010
mod_id=crystals
11-
mod_version=1.2.2
11+
mod_version=1.2.3
1212
mod_license=CC-BY-4.0
1313
mod_name=Crystals
1414
mod_description=A simple mod witch adds crystals ores.
@@ -20,7 +20,7 @@ maven_group=github.killarexe
2020

2121
# Fabric Settings
2222
fabric_loader_version=0.15.11
23-
fabric_api_version=0.100.1+1.21
23+
fabric_api_version=0.102.0+1.21
2424

2525
# Neoforge Settings
2626
neoforge_version=21.0.0-beta

neoforge/src/main/resources/META-INF/neoforge.mods.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ version="${mod_version}"
99
displayName="${mod_name}"
1010
updateJSONURL="https://raw.githubusercontent.com/Killarexe/Crystals/master/neoforge/update.json"
1111
displayURL="${mod_url}"
12-
logoFile="title.png"
12+
logoFile="assets/crystals/icon.png"
1313
authors="Killar"
1414
displayTest="MATCH_VERSION"
1515
description='''${mod_description}'''
@@ -26,4 +26,4 @@ modId="minecraft"
2626
type="required"
2727
versionRange="${minecraft_version_range}"
2828
ordering="NONE"
29-
side="BOTH"
29+
side="BOTH"

0 commit comments

Comments
 (0)