Skip to content

Instantly share code, notes, and snippets.

@czaux
Created December 31, 2019 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save czaux/f7335cf573c8d9bc268bc12b2b135291 to your computer and use it in GitHub Desktop.
Save czaux/f7335cf573c8d9bc268bc12b2b135291 to your computer and use it in GitHub Desktop.
@SubscribeEvent
public void EnteringChunk(net.minecraftforge.event.entity.EntityEvent.EnteringChunk event) {
if(KMCFConfig.Stop_Cellien_Spawns) {
if(event.getEntity() instanceof EntityPlayer) return;
if(event.getEntity() instanceof EntityLivingBase) {
Entity aa = event.getEntity();
String name = aa.getName();
if(name.indexOf("Cellien") != -1) {
//TODO: Probably match mod name but can't find how to do that.
switch(name) {
case "Cellien":
case "Red Cellien":
case "Big Cellien":
case "Big Red Cellien": {
this.handleCellienSpawn(aa);
}
default: {}
}
}
}
}
}
private void handleCellienSpawn(Entity entity) {
if(KMCFConfig.Stop_Cellien_Spawns) {
entity.setInvisible(true);
entity.setSilent(true);
World world = entity.getEntityWorld();
world.removeEntity(entity);
KMCFMod.logger.info("removed cellien");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment