-
Notifications
You must be signed in to change notification settings - Fork 0
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 #1 from dgrfps/1.20.6
1.20.6 Porting
- Loading branch information
Showing
10 changed files
with
77 additions
and
82 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,40 @@ | ||
package dgrfps.pfmc.items; | ||
|
||
import dgrfps.pfmc.Main; | ||
import net.fabricmc.fabric.api.item.v1.FabricItemSettings; | ||
import dgrfps.pfmc.PFMC; | ||
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; | ||
import net.fabricmc.fabric.api.registry.CompostingChanceRegistry; | ||
import net.minecraft.item.FoodComponents; | ||
import net.minecraft.component.type.FoodComponent; | ||
import net.minecraft.entity.effect.StatusEffectInstance; | ||
import net.minecraft.entity.effect.StatusEffects; | ||
import net.minecraft.item.Item.Settings; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemGroups; | ||
import net.minecraft.registry.Registries; | ||
import net.minecraft.registry.Registry; | ||
import net.minecraft.util.Identifier; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
|
||
public class ItemRegistry { | ||
public static final Item POOP = registerItem("poop", new PoopItem(new FabricItemSettings().food(FoodComponents.ROTTEN_FLESH))); | ||
public static final Item POOP = registerItem("poop", new PoopItem(new Settings().food( | ||
new FoodComponent(-1, -2, true, 1f, new ArrayList<FoodComponent.StatusEffectEntry>(Arrays.asList( | ||
new FoodComponent.StatusEffectEntry(new StatusEffectInstance(StatusEffects.NAUSEA, 10 * 20), 1), | ||
new FoodComponent.StatusEffectEntry(new StatusEffectInstance(StatusEffects.SLOWNESS, 10 * 20), 1), | ||
new FoodComponent.StatusEffectEntry(new StatusEffectInstance(StatusEffects.HUNGER, 10 * 20), 1) | ||
)) | ||
)))); | ||
|
||
public static void Init() | ||
{ | ||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.NATURAL).register((e) -> { | ||
e.add(POOP); | ||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.FOOD_AND_DRINK).register((itemGroupEntries) -> { | ||
itemGroupEntries.add(POOP); | ||
}); | ||
|
||
CompostingChanceRegistry.INSTANCE.add(POOP, 2f); | ||
} | ||
public static Item registerItem(String name, Item item) | ||
{ | ||
return Registry.register(Registries.ITEM, new Identifier(Main.MODID, name), item); | ||
return Registry.register(Registries.ITEM, new Identifier(PFMC.MODID, name), item); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,29 +1,11 @@ | ||
package dgrfps.pfmc.items; | ||
|
||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.effect.StatusEffectInstance; | ||
import net.minecraft.entity.effect.StatusEffects; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.sound.SoundEvents; | ||
import net.minecraft.world.World; | ||
|
||
public class PoopItem extends Item { | ||
public PoopItem(Settings settings) | ||
{ | ||
super(settings); | ||
} | ||
|
||
@Override | ||
public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) { | ||
if (this.isFood()) { | ||
user.playSound(SoundEvents.ENTITY_VILLAGER_NO, 1f, 1f); | ||
|
||
user.addStatusEffect(new StatusEffectInstance(StatusEffects.NAUSEA, 3 * 20)); | ||
user.addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 3 * 20, 2)); | ||
|
||
return user.eatFood(world, stack); | ||
} | ||
return stack; | ||
} | ||
} |
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
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