-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix zombie appearing in 40 blocks range near the XU spikes (#155)
* Fix zombie appearing in 40 blocks range near the XU spikes Co-authored-by: Andrey <[email protected]> Co-authored-by: Jason Mitchell <[email protected]>
- Loading branch information
1 parent
ca4994d
commit 6cc4598
Showing
5 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/main/java/com/mitchej123/hodgepodge/HodgepodgeEventHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.mitchej123.hodgepodge; | ||
|
||
import cpw.mods.fml.common.eventhandler.Event; | ||
import cpw.mods.fml.common.eventhandler.SubscribeEvent; | ||
import net.minecraftforge.event.entity.living.ZombieEvent; | ||
|
||
public class HodgepodgeEventHandler { | ||
private boolean xuDisableAidTrigger; | ||
|
||
@SubscribeEvent | ||
public void onZombieAidSummon(ZombieEvent.SummonAidEvent event) { | ||
if (!event.world.isRemote && xuDisableAidTrigger) { | ||
event.setResult(Event.Result.DENY); | ||
} | ||
} | ||
|
||
public void setAidTriggerDisabled(boolean disableAidTrigger) { | ||
xuDisableAidTrigger = disableAidTrigger; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/main/java/com/mitchej123/hodgepodge/mixins/late/extrautilities/MixinBlockSpike.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.mitchej123.hodgepodge.mixins.late.extrautilities; | ||
|
||
import com.mitchej123.hodgepodge.Hodgepodge; | ||
import com.rwtema.extrautils.block.BlockSpike; | ||
import com.rwtema.extrautils.block.BlockSpikeDiamond; | ||
import com.rwtema.extrautils.block.BlockSpikeGold; | ||
import com.rwtema.extrautils.block.BlockSpikeWood; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.world.World; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(value = {BlockSpike.class, BlockSpikeDiamond.class, BlockSpikeGold.class, BlockSpikeWood.class}) | ||
public abstract class MixinBlockSpike { | ||
|
||
@Inject( | ||
method = "onEntityCollidedWithBlock(Lnet/minecraft/world/World;IIILnet/minecraft/entity/Entity;)V", | ||
at = @At("HEAD")) | ||
public void onEntityCollidedWithBlockStart(World world, int x, int y, int z, Entity target, CallbackInfo ci) { | ||
if (!world.isRemote) { | ||
Hodgepodge.EVENT_HANDLER.setAidTriggerDisabled(true); | ||
} | ||
} | ||
|
||
@Inject( | ||
method = "onEntityCollidedWithBlock(Lnet/minecraft/world/World;IIILnet/minecraft/entity/Entity;)V", | ||
at = @At("RETURN")) | ||
public void onEntityCollidedWithBlockEnd(World world, int x, int y, int z, Entity target, CallbackInfo ci) { | ||
if (!world.isRemote) { | ||
Hodgepodge.EVENT_HANDLER.setAidTriggerDisabled(false); | ||
} | ||
} | ||
} |