Skip to content

Commit

Permalink
Add spawner blacklist
Browse files Browse the repository at this point in the history
  • Loading branch information
Rearth committed Dec 12, 2024
1 parent e74883e commit 9216294
Show file tree
Hide file tree
Showing 7 changed files with 136 additions and 92 deletions.
Original file line number Diff line number Diff line change
@@ -1,112 +1,112 @@
{
"values": [
"oritech:biosteel_block",
"oritech:particle_collector_block",
"oritech:industrial_glass_block",
"oritech:machine_core_6",
"oritech:quarry_addon",
"oritech:machine_core_2",
"oritech:metal_beam_block",
"oritech:steam_engine_block",
"oritech:reactor_condenser",
"oritech:machine_hunter_addon",
"oritech:nickel_block",
"oritech:placer_block",
"oritech:machine_core_4",
"oritech:powered_furnace_block",
"oritech:nickel_plating_slab",
"oritech:biomass_block",
"oritech:reactor_double_rod",
"oritech:machine_capacitor_addon",
"oritech:machine_efficiency_addon",
"oritech:machine_plating_block",
"oritech:ceiling_light_hanging",
"oritech:pump_block",
"oritech:machine_core_7",
"oritech:plastic_block",
"oritech:machine_redstone_addon",
"oritech:foundry_block",
"oritech:pipe_booster_block",
"oritech:raw_nickel_block",
"oritech:reactor_energy_port",
"oritech:machine_plating_pressure_plate",
"oritech:duratium_block",
"oritech:drone_port_block",
"oritech:fertilizer_block",
"oritech:large_storage_block",
"oritech:accelerator_sensor",
"oritech:adamant_block",
"oritech:iron_plating_block",
"oritech:machine_core_3",
"oritech:item_filter_block",
"oritech:big_solar_panel_block",
"oritech:reactor_double_rod",
"oritech:machine_core_4",
"oritech:iron_plating_pressure_plate",
"oritech:deep_drill_block",
"oritech:machine_acceptor_addon",
"oritech:enchanter_block",
"oritech:spawner_controller_block",
"oritech:fragment_forge_block",
"oritech:machine_fluid_addon",
"oritech:energy_pipe",
"oritech:machine_speed_addon",
"oritech:creative_storage_block",
"oritech:ceiling_light_hanging",
"oritech:machine_plating_stairs",
"oritech:accelerator_controller",
"oritech:machine_plating_slab",
"oritech:bio_generator_block",
"oritech:superconductor",
"oritech:machine_core_1",
"oritech:crop_filter_addon",
"oritech:machine_extender",
"oritech:reactor_absorber_port",
"oritech:reactor_fuel_port",
"oritech:steel_block",
"oritech:tech_button",
"oritech:item_pipe",
"oritech:machine_inventory_proxy_addon",
"oritech:biosteel_block",
"oritech:machine_speed_addon",
"oritech:machine_frame_block",
"oritech:machine_core_5",
"oritech:ceiling_light",
"oritech:machine_plating_block",
"oritech:raw_platinum_block",
"oritech:reactor_reflector",
"oritech:enchantment_catalyst_block",
"oritech:basic_generator_block",
"oritech:fluid_pipe",
"oritech:reactor_quad_rod",
"oritech:accelerator_ring",
"oritech:spawner_cage_block",
"oritech:fuel_generator_block",
"oritech:laser_arm_block",
"oritech:crop_filter_addon",
"oritech:reactor_heat_pipe",
"oritech:duratium_block",
"oritech:platinum_block",
"oritech:machine_inventory_proxy_addon",
"oritech:reactor_wall",
"oritech:centrifuge_block",
"oritech:energite_block",
"oritech:fluxite_block",
"oritech:iron_plating_stairs",
"oritech:raw_nickel_block",
"oritech:tech_door",
"oritech:destroyer_block",
"oritech:machine_core_3",
"oritech:reactor_rod",
"oritech:silicon_block",
"oritech:accelerator_motor",
"oritech:nickel_plating_stairs",
"oritech:reactor_vent",
"oritech:tech_button",
"oritech:ceiling_light",
"oritech:item_filter_block",
"oritech:fluxite_block",
"oritech:atomic_forge_block",
"oritech:machine_yield_addon",
"oritech:iron_plating_pressure_plate",
"oritech:big_solar_panel_block",
"oritech:reactor_heat_pipe",
"oritech:iron_plating_slab",
"oritech:iron_plating_stairs",
"oritech:pulverizer_block",
"oritech:centrifuge_block",
"oritech:electrum_block",
"oritech:fluid_pipe",
"oritech:reactor_quad_rod",
"oritech:enchantment_catalyst_block",
"oritech:reactor_energy_port",
"oritech:nickel_plating_pressure_plate",
"oritech:tech_lever",
"oritech:pipe_booster_block",
"oritech:reactor_wall",
"oritech:capacitor_addon_extender",
"oritech:machine_core_2",
"oritech:treefeller_block",
"oritech:iron_plating_slab",
"oritech:large_storage_block",
"oritech:machine_plating_slab",
"oritech:machine_fluid_addon",
"oritech:accelerator_controller",
"oritech:particle_collector_block",
"oritech:reactor_absorber_port",
"oritech:machine_hunter_addon",
"oritech:assembler_block",
"oritech:machine_frame_block",
"oritech:energite_block",
"oritech:powered_furnace_block",
"oritech:plastic_block",
"oritech:accelerator_sensor",
"oritech:electrum_block",
"oritech:destroyer_block",
"oritech:fuel_generator_block",
"oritech:biomass_block",
"oritech:bio_generator_block",
"oritech:placer_block",
"oritech:spawner_controller_block",
"oritech:iron_plating_block",
"oritech:nickel_plating_slab",
"oritech:fertilizer_block",
"oritech:lava_generator_block",
"oritech:steam_boiler_addon",
"oritech:item_pipe",
"oritech:machine_core_5",
"oritech:reactor_controller",
"oritech:charger_block",
"oritech:treefeller_block",
"oritech:capacitor_addon_extender",
"oritech:nickel_plating_block",
"oritech:laser_arm_block",
"oritech:superconductor",
"oritech:creative_storage_block",
"oritech:steam_engine_block",
"oritech:enchanter_block",
"oritech:accelerator_motor",
"oritech:basic_generator_block",
"oritech:steam_boiler_addon",
"oritech:reactor_reflector",
"oritech:nickel_block",
"oritech:spawner_cage_block",
"oritech:black_hole_block",
"oritech:nickel_plating_stairs",
"oritech:industrial_glass_block",
"oritech:quarry_addon",
"oritech:adamant_block",
"oritech:atomic_forge_block",
"oritech:machine_capacitor_addon",
"oritech:reactor_condenser",
"oritech:machine_core_7",
"oritech:machine_efficiency_addon",
"oritech:machine_plating_stairs",
"oritech:machine_acceptor_addon",
"oritech:reactor_vent",
"oritech:machine_extender",
"oritech:metal_beam_block",
"oritech:machine_core_1",
"oritech:reactor_controller",
"oritech:reactor_fuel_port",
"oritech:machine_plating_pressure_plate",
"oritech:accelerator_ring",
"oritech:energy_pipe",
"oritech:reactor_rod",
"oritech:fragment_forge_block",
"oritech:pulverizer_block",
"oritech:foundry_block",
"oritech:machine_core_6",
"oritech:drone_port_block",
"oritech:tech_lever",
"oritech:energy_pipe_connection",
"oritech:fluid_pipe_connection",
"oritech:item_pipe_connection",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"minecraft:ender_dragon"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import rearth.oritech.client.init.ParticleContent;
import rearth.oritech.init.BlockContent;
import rearth.oritech.init.BlockEntitiesContent;
import rearth.oritech.init.TagContent;
import rearth.oritech.network.NetworkContent;

public class SpawnerControllerBlockEntity extends BaseSoulCollectionEntity implements BlockEntityTicker<SpawnerControllerBlockEntity> {
Expand Down Expand Up @@ -201,7 +202,15 @@ public void onEntitySteppedOn(Entity entity) {
if (spawnedMob != null) return;

if (entity instanceof MobEntity mobEntity) {

if (mobEntity.getType().arch$holder().isIn(TagContent.SPAWNER_BLACKLIST)) {
Oritech.LOGGER.debug("Ignored blacklisted entity for spawner: " + mobEntity.getType().arch$registryName());
return;
}

spawnedMob = mobEntity.getType();


networkDirty = true;
maxSouls = getSoulCost((int) mobEntity.getMaxHealth());

Expand Down
4 changes: 4 additions & 0 deletions common/src/main/java/rearth/oritech/init/TagContent.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package rearth.oritech.init;

import net.minecraft.block.Block;
import net.minecraft.entity.EntityType;
import net.minecraft.item.Item;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.TagKey;
Expand Down Expand Up @@ -72,4 +73,7 @@ public class TagContent {
public static final TagKey<Item> RAW_BLUE_DYE = TagKey.of(RegistryKeys.ITEM, Identifier.of("c", "raw_materials/dyes/blue"));
public static final TagKey<Item> RAW_MAGENTA_DYE = TagKey.of(RegistryKeys.ITEM, Identifier.of("c", "raw_materials/dyes/magenta"));
public static final TagKey<Item> RAW_PINK_DYE = TagKey.of(RegistryKeys.ITEM, Identifier.of("c", "raw_materials/dyes/pink"));

// spawner blacklist
public static final TagKey<EntityType<?>> SPAWNER_BLACKLIST = TagKey.of(RegistryKeys.ENTITY_TYPE, Oritech.id("spawner_blacklist"));
}
4 changes: 4 additions & 0 deletions docs/arcane/mob_spawning.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ Mobs will only spawn if an empty surface is available nearby.

When a mob type is set (or when right-clicked if invalid), the spawner highlights the required size of the spawner cage below.
You can also right-click the spawner to get information on the current operational state.

<Callout variant="info">
The spawner will not cage any mob types that match the "oritech:spawner_blacklist" tag.
</Callout>
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
pack.addProvider(ItemTagGenerator::new);
pack.addProvider(RecipeGenerator::new);
pack.addProvider(AdvancementGenerator::new);
pack.addProvider(EntityTagGenerator::new);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package rearth.oritech.fabricgen.datagen;

import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
import net.minecraft.entity.EntityType;
import net.minecraft.registry.RegistryWrapper;
import rearth.oritech.init.TagContent;

import java.util.concurrent.CompletableFuture;

public class EntityTagGenerator extends FabricTagProvider.EntityTypeTagProvider {
public EntityTagGenerator(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> completableFuture) {
super(output, completableFuture);
}

@Override
protected void configure(RegistryWrapper.WrapperLookup wrapperLookup) {
getOrCreateTagBuilder(TagContent.SPAWNER_BLACKLIST)
.add(EntityType.ENDER_DRAGON); // this should never actually be loaded, but it's here as a failsafe
}
}

0 comments on commit 9216294

Please sign in to comment.