-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #353 from IcarussOne/main
Chicken Shedding Tweak
- Loading branch information
Showing
4 changed files
with
52 additions
and
0 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
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
31 changes: 31 additions & 0 deletions
31
.../java/mod/acgaming/universaltweaks/tweaks/entities/chickenshedding/UTChickenShedding.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,31 @@ | ||
package mod.acgaming.universaltweaks.tweaks.entities.chickenshedding; | ||
|
||
import net.minecraft.entity.passive.EntityChicken; | ||
import net.minecraft.init.Items; | ||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; | ||
import net.minecraftforge.fml.common.Mod; | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | ||
|
||
import mod.acgaming.universaltweaks.UniversalTweaks; | ||
import mod.acgaming.universaltweaks.config.UTConfigGeneral; | ||
import mod.acgaming.universaltweaks.config.UTConfigTweaks; | ||
|
||
// Courtesy of holmraven | ||
@Mod.EventBusSubscriber(modid = UniversalTweaks.MODID) | ||
public class UTChickenShedding { | ||
@SubscribeEvent | ||
public static void onLivingUpdate(LivingUpdateEvent event) | ||
{ | ||
if (event.getEntity().world.isRemote || !(event.getEntity() instanceof EntityChicken) || !(UTConfigTweaks.ENTITIES.CHICKEN_SHEDDING.utChickenSheddingToggle)) | ||
{ | ||
return; | ||
} | ||
|
||
EntityChicken chicken = (EntityChicken) event.getEntity(); | ||
if (UTConfigTweaks.ENTITIES.CHICKEN_SHEDDING.utChickenSheddingBabyToggle || !(chicken.isChild()) && chicken.world.rand.nextInt(UTConfigTweaks.ENTITIES.CHICKEN_SHEDDING.utChickenSheddingFrequency) == 0) | ||
{ | ||
if (UTConfigGeneral.DEBUG.utDebugToggle) UniversalTweaks.LOGGER.debug("UTChickenShedding ::: Living update event"); | ||
chicken.dropItem(Items.FEATHER, 1); | ||
} | ||
} | ||
} |
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