Skip to content

Commit b8da211

Browse files
committed
Fixed branch connectables change crashing game
1 parent 2367afe commit b8da211

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/main/java/com/ferreusveritas/dynamictrees/systems/BranchConnectables.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package com.ferreusveritas.dynamictrees.systems;
22

3+
import com.ferreusveritas.dynamictrees.DynamicTrees;
34
import com.ferreusveritas.dynamictrees.tree.family.Family;
45
import com.ferreusveritas.dynamictrees.util.function.TetraFunction;
56
import net.minecraft.core.BlockPos;
67
import net.minecraft.core.Direction;
8+
import net.minecraft.resources.ResourceLocation;
79
import net.minecraft.world.level.BlockGetter;
810
import net.minecraft.world.level.block.Block;
911
import net.minecraft.world.level.block.state.BlockState;
@@ -19,17 +21,17 @@
1921
*/
2022
public class BranchConnectables {
2123

22-
private static final Map<Block, Map<Family, TetraFunction<BlockState, BlockGetter, BlockPos, Direction, Integer>>> connectablesMap = new HashMap<>();
24+
private static final Map<Block, Map<ResourceLocation, TetraFunction<BlockState, BlockGetter, BlockPos, Direction, Integer>>> connectablesMap = new HashMap<>();
2325

2426
//Direction can be null
25-
public static void makeBlockConnectable(Block block, TetraFunction<BlockState, BlockGetter, BlockPos, Direction, Integer> radiusFunction, Family family) {
27+
public static void makeBlockConnectable(Block block, TetraFunction<BlockState, BlockGetter, BlockPos, Direction, Integer> radiusFunction, ResourceLocation family) {
2628
var map = connectablesMap.computeIfAbsent(block, k -> new HashMap<>());
2729
map.putIfAbsent(family, radiusFunction);
2830
}
2931
public static void makeBlockConnectable(Block block, TetraFunction<BlockState, BlockGetter, BlockPos, Direction, Integer> radiusFunction) {
30-
makeBlockConnectable(block, radiusFunction, Family.NULL_FAMILY);
32+
makeBlockConnectable(block, radiusFunction, DynamicTrees.location("null"));
3133
}
32-
public static void replaceBlockConnectable(Block block, TetraFunction<BlockState, BlockGetter, BlockPos, Direction, Integer> radiusFunction, Family family) {
34+
public static void replaceBlockConnectable(Block block, TetraFunction<BlockState, BlockGetter, BlockPos, Direction, Integer> radiusFunction, ResourceLocation family) {
3335
var map = connectablesMap.computeIfAbsent(block, k -> new HashMap<>());
3436
map.remove(family);
3537
map.put(family, radiusFunction);
@@ -57,9 +59,9 @@ public static int getConnectionRadiusForBlock(BlockState state, BlockGetter worl
5759
private static TetraFunction<BlockState, BlockGetter, BlockPos, Direction, Integer> getFunctionForFamily(Block block, Family family){
5860
var familyMap = connectablesMap.get(block);
5961
if (familyMap == null) return null;
60-
var function = familyMap.get(family);
62+
var function = familyMap.get(family.getRegistryName());
6163
if (function == null){
62-
function = familyMap.get(Family.NULL_FAMILY);
64+
function = familyMap.get(DynamicTrees.location("null"));
6365
}
6466
return function;
6567
}

0 commit comments

Comments
 (0)