Skip to content

Commit d8f1134

Browse files
committed
feat: be more informative
1 parent 06d8f60 commit d8f1134

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
package gregtech.api.block;
22

33
import net.minecraft.block.state.IBlockState;
4+
import net.minecraft.entity.EntityLiving;
5+
import net.minecraft.util.math.BlockPos;
6+
import net.minecraft.world.IBlockAccess;
47

58
import org.jetbrains.annotations.NotNull;
69

710
public interface IStateSpawnControl {
811

9-
boolean canCreatureSpawn(@NotNull IBlockState state);
12+
boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos,
13+
@NotNull EntityLiving.SpawnPlacementType type);
1014
}

src/main/java/gregtech/api/block/VariantBlock.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public SoundType getSoundType(@NotNull IBlockState state, @NotNull World world,
131131
public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos,
132132
@NotNull EntityLiving.SpawnPlacementType type) {
133133
if (getState(state) instanceof IStateSpawnControl stateSpawnControl) {
134-
return stateSpawnControl.canCreatureSpawn(state);
134+
return stateSpawnControl.canCreatureSpawn(state, world, pos, type);
135135
}
136136
return super.canCreatureSpawn(state, world, pos, type);
137137
}

src/main/java/gregtech/common/blocks/StoneVariantBlock.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313
import net.minecraft.block.properties.PropertyEnum;
1414
import net.minecraft.block.state.BlockStateContainer;
1515
import net.minecraft.block.state.IBlockState;
16+
import net.minecraft.entity.EntityLiving;
1617
import net.minecraft.item.Item;
1718
import net.minecraft.util.IStringSerializable;
19+
import net.minecraft.util.math.BlockPos;
20+
import net.minecraft.world.IBlockAccess;
1821

1922
import org.jetbrains.annotations.NotNull;
2023

@@ -108,7 +111,8 @@ public Material getMaterial() {
108111
}
109112

110113
@Override
111-
public boolean canCreatureSpawn(@NotNull IBlockState state) {
114+
public boolean canCreatureSpawn(@NotNull IBlockState state, @NotNull IBlockAccess world, @NotNull BlockPos pos,
115+
@NotNull EntityLiving.SpawnPlacementType type) {
112116
return this.allowSpawn;
113117
}
114118
}

0 commit comments

Comments
 (0)