Skip to content

Commit

Permalink
Add config option to disable villager lightning conversion
Browse files Browse the repository at this point in the history
Closes #1053
  • Loading branch information
rubensworks committed Sep 1, 2024
1 parent a084dbc commit 35e4471
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.world.entity.npc.VillagerProfession;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.village.VillagerTradesEvent;
import org.cyclops.cyclopscore.config.ConfigurableProperty;
import org.cyclops.cyclopscore.config.extendedconfig.VillagerConfig;
import org.cyclops.evilcraft.EvilCraft;
import org.cyclops.evilcraft.Reference;
Expand All @@ -18,6 +19,9 @@
*/
public class VillagerProfessionWerewolfConfig extends VillagerConfig {

@ConfigurableProperty(category = "mob", comment = "If villagers struck by lightning should have a 50% chance of becoming a werewolf villager", isCommandable = true)
public static boolean convertOnLightning = true;

public VillagerProfessionWerewolfConfig() {
super(
EvilCraft._instance,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraftforge.eventbus.api.SubscribeEvent;
import org.cyclops.evilcraft.RegistryEntries;
import org.cyclops.evilcraft.entity.monster.EntityWerewolf;
import org.cyclops.evilcraft.entity.villager.VillagerProfessionWerewolfConfig;
import org.cyclops.evilcraft.item.IItemEmpowerable;

import java.util.HashSet;
Expand Down Expand Up @@ -49,7 +50,7 @@ private void empowerItem(EntityStruckByLightningEvent event) {
private Set<Integer> affectedVillagers;

private void transformVillager(EntityStruckByLightningEvent event) {
if (event.getEntity() instanceof Villager) {
if (event.getEntity() instanceof Villager && VillagerProfessionWerewolfConfig.convertOnLightning) {
Villager entity = (Villager) event.getEntity();
if(lastLightningBolt != event.getLightning()) {
lastLightningBolt = event.getLightning();
Expand Down

0 comments on commit 35e4471

Please sign in to comment.