Add effects for various blocks
This commit is contained in:
parent
1fe805e9a6
commit
475059df8f
1 changed files with 63 additions and 7 deletions
|
@ -1,7 +1,11 @@
|
|||
package observer.nelle.edible_blocks.mixin;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.entity.effect.StatusEffects;
|
||||
import net.minecraft.item.FoodComponent;
|
||||
import net.minecraft.item.FoodComponents;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Items;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
@ -9,14 +13,65 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
|
||||
|
||||
|
||||
@Mixin(Items.class)
|
||||
public abstract class ItemsMixin {
|
||||
|
||||
@ModifyArg(
|
||||
method = "register(Lnet/minecraft/block/Block;)Lnet/minecraft/item/Item;",
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/item/BlockItem;<init>(Lnet/minecraft/block/Block;Lnet/minecraft/item/Item$Settings;)V")
|
||||
)
|
||||
private static Item.Settings ModifySettings(Block block, Item.Settings settings) {
|
||||
/* TODO: Make pumpkin give player a carved pumpkin
|
||||
if (block == Blocks.PUMPKIN) {
|
||||
return settings.food(new FoodComponent.Builder()
|
||||
.hunger(6)
|
||||
.saturationModifier(0.9F)
|
||||
.build());
|
||||
}*/
|
||||
if (block == Blocks.MELON) {
|
||||
return settings.food(new FoodComponent.Builder()
|
||||
.hunger(6)
|
||||
.saturationModifier(0.9F)
|
||||
.build());
|
||||
}
|
||||
if (block == Blocks.HONEY_BLOCK) {
|
||||
return settings.food(new FoodComponent.Builder()
|
||||
.hunger(9)
|
||||
.saturationModifier(0.3F)
|
||||
.statusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 5, 1 / 2), 0.7f)
|
||||
.build());
|
||||
}
|
||||
if (block == Blocks.HONEYCOMB_BLOCK) {
|
||||
return settings.food(new FoodComponent.Builder()
|
||||
.hunger(9)
|
||||
.saturationModifier(0.3F)
|
||||
.statusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 5, 1 / 2), 0.7f)
|
||||
.build());
|
||||
}
|
||||
if (block == Blocks.BEEHIVE) {
|
||||
return settings.food(new FoodComponent.Builder()
|
||||
.hunger(9)
|
||||
.saturationModifier(0.3F)
|
||||
.statusEffect(new StatusEffectInstance(StatusEffects.INSTANT_DAMAGE, 1, 1 / 2), 1f)
|
||||
.statusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 5, 1 / 2), 0.7f)
|
||||
.build());
|
||||
}
|
||||
if (block == Blocks.BEE_NEST) {
|
||||
return settings.food(new FoodComponent.Builder()
|
||||
.hunger(9)
|
||||
.saturationModifier(0.3F)
|
||||
.statusEffect(new StatusEffectInstance(StatusEffects.INSTANT_DAMAGE, 1, 1 / 2), 1f)
|
||||
.statusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 5, 1 / 2), 0.4f)
|
||||
.build());
|
||||
}
|
||||
if (block == Blocks.CACTUS) {
|
||||
return settings.food(new FoodComponent.Builder()
|
||||
.hunger(9)
|
||||
.saturationModifier(0.3F)
|
||||
.statusEffect(new StatusEffectInstance(StatusEffects.INSTANT_DAMAGE, 1, 1 / 3), 1f)
|
||||
.build());
|
||||
}
|
||||
else {
|
||||
return settings.food(
|
||||
new FoodComponent.Builder()
|
||||
.snack()
|
||||
|
@ -25,3 +80,4 @@ public abstract class ItemsMixin {
|
|||
.build());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue