Set butterfly spawn conditions to include more blocks

This commit is contained in:
Sollace 2024-03-31 02:38:59 +01:00
parent 2784627adc
commit 1503cb5773
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
3 changed files with 5 additions and 1 deletions

View file

@ -83,6 +83,8 @@ public interface UTags {
TagKey<Block> CLOUD_STAIRS = block("cloud_stairs"); TagKey<Block> CLOUD_STAIRS = block("cloud_stairs");
TagKey<Block> CLOUD_BLOCKS = block("cloud_blocks"); TagKey<Block> CLOUD_BLOCKS = block("cloud_blocks");
TagKey<Block> CHITIN_BLOCKS = block("chitin_blocks"); TagKey<Block> CHITIN_BLOCKS = block("chitin_blocks");
TagKey<Block> BUTTERFLIES_SPAWNABLE_ON = block("butterflies_spawn_on");
} }
static TagKey<Item> item(String name) { static TagKey<Item> item(String name) {

View file

@ -40,6 +40,7 @@ public class UBlockTagProvider extends FabricTagProvider.BlockTagProvider {
}; };
getOrCreateTagBuilder(UTags.CATAPULT_IMMUNE).add(Blocks.BEDROCK).forceAddTag(BlockTags.DOORS).forceAddTag(BlockTags.TRAPDOORS); getOrCreateTagBuilder(UTags.CATAPULT_IMMUNE).add(Blocks.BEDROCK).forceAddTag(BlockTags.DOORS).forceAddTag(BlockTags.TRAPDOORS);
getOrCreateTagBuilder(UTags.Blocks.BUTTERFLIES_SPAWNABLE_ON).forceAddTag(BlockTags.ANIMALS_SPAWNABLE_ON).forceAddTag(BlockTags.LEAVES).forceAddTag(BlockTags.FLOWERS).forceAddTag(BlockTags.FLOWER_POTS);
getOrCreateTagBuilder(UTags.JARS).add(UBlocks.JAR, UBlocks.CLOUD_JAR, UBlocks.STORM_JAR, UBlocks.LIGHTNING_JAR, UBlocks.ZAP_JAR); getOrCreateTagBuilder(UTags.JARS).add(UBlocks.JAR, UBlocks.CLOUD_JAR, UBlocks.STORM_JAR, UBlocks.LIGHTNING_JAR, UBlocks.ZAP_JAR);
getOrCreateTagBuilder(BlockTags.CROPS).add(crops); getOrCreateTagBuilder(BlockTags.CROPS).add(crops);
getOrCreateTagBuilder(BlockTags.BEE_GROWABLES).add(crops); getOrCreateTagBuilder(BlockTags.BEE_GROWABLES).add(crops);

View file

@ -11,6 +11,7 @@ import java.util.stream.Collectors;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import com.minelittlepony.unicopia.USounds; import com.minelittlepony.unicopia.USounds;
import com.minelittlepony.unicopia.UTags;
import com.minelittlepony.unicopia.Unicopia; import com.minelittlepony.unicopia.Unicopia;
import com.minelittlepony.unicopia.item.ButterflyItem; import com.minelittlepony.unicopia.item.ButterflyItem;
import com.minelittlepony.unicopia.util.NbtSerialisable; import com.minelittlepony.unicopia.util.NbtSerialisable;
@ -73,7 +74,7 @@ public class ButterflyEntity extends AmbientEntity {
} }
public static boolean canSpawn(EntityType<? extends ButterflyEntity> type, WorldAccess world, SpawnReason spawnReason, BlockPos pos, Random random) { public static boolean canSpawn(EntityType<? extends ButterflyEntity> type, WorldAccess world, SpawnReason spawnReason, BlockPos pos, Random random) {
return world.getBlockState(pos.down()).isIn(BlockTags.ANIMALS_SPAWNABLE_ON); return world.getBlockState(pos.down()).isIn(UTags.Blocks.BUTTERFLIES_SPAWNABLE_ON);
} }
@Override @Override