( Patch for #1498 ) protect villager npcs from lightning (#1504)

This commit is contained in:
Julian v.d Berkmortel 2018-06-07 11:08:39 +02:00 committed by fullwall
parent 4ae8a19b33
commit 5d04746a99
4 changed files with 32 additions and 0 deletions

View File

@ -23,6 +23,7 @@ import net.minecraft.server.v1_10_R1.ItemStack;
import net.minecraft.server.v1_10_R1.NBTTagCompound;
import net.minecraft.server.v1_10_R1.SoundEffect;
import net.minecraft.server.v1_10_R1.World;
import net.minecraft.server.v1_10_R1.EntityLightning;
public class VillagerController extends MobEntityController {
public VillagerController() {
@ -218,6 +219,13 @@ public class VillagerController extends MobEntityController {
}
}
@Override
public void onLightningStrike(EntityLightning entitylightning) {
if (npc == null) {
super.onLightningStrike(entitylightning);
}
}
public void setBlockTrades(boolean blocked) {
this.blockTrades = blocked;
}

View File

@ -25,6 +25,7 @@ import net.minecraft.server.v1_11_R1.MerchantRecipe;
import net.minecraft.server.v1_11_R1.NBTTagCompound;
import net.minecraft.server.v1_11_R1.SoundEffect;
import net.minecraft.server.v1_11_R1.World;
import net.minecraft.server.v1_11_R1.EntityLightning;
public class VillagerController extends MobEntityController {
public VillagerController() {
@ -224,6 +225,13 @@ public class VillagerController extends MobEntityController {
}
}
@Override
public void onLightningStrike(EntityLightning entitylightning) {
if (npc == null) {
super.onLightningStrike(entitylightning);
}
}
public void setBlockTrades(boolean blocked) {
this.blockTrades = blocked;
}

View File

@ -26,6 +26,7 @@ import net.minecraft.server.v1_12_R1.MerchantRecipe;
import net.minecraft.server.v1_12_R1.NBTTagCompound;
import net.minecraft.server.v1_12_R1.SoundEffect;
import net.minecraft.server.v1_12_R1.World;
import net.minecraft.server.v1_12_R1.EntityLightning;
public class VillagerController extends MobEntityController {
public VillagerController() {
@ -227,6 +228,13 @@ public class VillagerController extends MobEntityController {
}
}
@Override
public void onLightningStrike(EntityLightning entitylightning) {
if (npc == null) {
super.onLightningStrike(entitylightning);
}
}
public void setBlockTrades(boolean blocked) {
this.blockTrades = blocked;
}

View File

@ -20,6 +20,7 @@ import net.minecraft.server.v1_8_R3.EntityHuman;
import net.minecraft.server.v1_8_R3.EntityVillager;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.World;
import net.minecraft.server.v1_8_R3.EntityLightning;
public class VillagerController extends MobEntityController {
public VillagerController() {
@ -210,6 +211,13 @@ public class VillagerController extends MobEntityController {
}
}
@Override
public void onLightningStrike(EntityLightning entitylightning) {
if (npc == null) {
super.onLightningStrike(entitylightning);
}
}
public void setBlockTrades(boolean blocked) {
this.blockTrades = blocked;
}