make lean effect

This commit is contained in:
Sunskimmer822 2022-02-24 11:32:28 -08:00
parent b1922e695c
commit da36b62cc8
5 changed files with 90 additions and 2 deletions

View File

@ -0,0 +1,29 @@
package net.serenas.shitmod;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectCategory;
import net.minecraft.entity.player.PlayerEntity;
public class ExpStatusEffect extends StatusEffect {
public ExpStatusEffect() {
super(
StatusEffectCategory.BENEFICIAL, // whether beneficial or harmful for entities
0x98D982); // color in RGB
}
// This method is called every tick to check whether it should apply the status effect or not
@Override
public boolean canApplyUpdateEffect(int duration, int amplifier) {
// In our case, we just make it return true so that it applies the status effect every tick.
return true;
}
// This method is called when it applies the status effect. We implement custom functionality here.
@Override
public void applyUpdateEffect(LivingEntity entity, int amplifier) {
if (entity instanceof PlayerEntity) {
((PlayerEntity) entity).addExperience(3 << amplifier); // Higher amplifier gives you EXP faster
}
}
}

View File

@ -6,7 +6,7 @@ public class Lean extends Item{
public Lean(Settings settings) {
super(settings);
//TODO Auto-generated constructor stub
}
}

View File

@ -0,0 +1,39 @@
package net.serenas.shitmod;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectCategory;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.player.PlayerEntity;
public class LeanStatusEffect extends StatusEffect{
public LeanStatusEffect() {
super(
StatusEffectCategory.HARMFUL, // whether beneficial or harmful for entities
0x98D982); // color in RGB
}
// This method is called every tick to check whether it should apply the status effect or not
@Override
public boolean canApplyUpdateEffect(int duration, int amplifier) {
// In our case, we just make it return true so that it applies the status effect every tick.
return true;
}
// This method is called when it applies the status effect. We implement custom functionality here.
@Override
public void applyUpdateEffect(LivingEntity entity, int amplifier) {
if (entity instanceof PlayerEntity) {
((PlayerEntity) entity).addStatusEffect(new StatusEffectInstance(StatusEffects.WEAKNESS));
((PlayerEntity) entity).addStatusEffect(new StatusEffectInstance(StatusEffects.BLINDNESS));
((PlayerEntity) entity).addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS));
((PlayerEntity) entity).addStatusEffect(new StatusEffectInstance(StatusEffects.POISON));
((PlayerEntity) entity).addStatusEffect(new StatusEffectInstance(StatusEffects.NAUSEA));
((PlayerEntity) entity).addStatusEffect(new StatusEffectInstance(StatusEffects.GLOWING));
((PlayerEntity) entity).addStatusEffect(new StatusEffectInstance(StatusEffects.MINING_FATIGUE));
}
}
}

View File

@ -5,11 +5,13 @@ import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.kyrptonaught.customportalapi.api.CustomPortalBuilder;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.Items;
import net.minecraft.util.Identifier;
import net.minecraft.util.Rarity;
import net.minecraft.util.registry.Registry;
public class Shitmod implements ModInitializer {
@ -19,13 +21,29 @@ public class Shitmod implements ModInitializer {
public static final Block FABRIC_BLOCK = new FabricBlock();
public static final Item HAUSBOMMER_ITEM = new Hausbommer(new Item.Settings().group(ItemGroup.MISC));
public static final Item LEAN = new Lean(new Item.Settings().group(ItemGroup.FOOD).rarity(Rarity.UNCOMMON));
public static final StatusEffect EXP = new ExpStatusEffect();
public static final StatusEffect LEAN_EFFECT = new LeanStatusEffect();
@Override
public void onInitialize() {
Registry.register(Registry.ITEM, new Identifier("shitmod", "fabric_item"), FABRIC_ITEM);
Registry.register(Registry.BLOCK, new Identifier("shitmod", "fabric_block"), FABRIC_BLOCK);
Registry.register(Registry.ITEM, new Identifier("shitmod", "fabric_block"), new BlockItem(FABRIC_BLOCK, new FabricItemSettings().group(ItemGroup.MISC)));
Registry.register(Registry.ITEM, new Identifier("shitmod", "hausbommer"), HAUSBOMMER_ITEM);
Registry.register(Registry.ITEM, new Identifier("shitmod", "lean"), LEAN);
Registry.register(Registry.STATUS_EFFECT, new Identifier("shitmod", "exp"), EXP);
Registry.register(Registry.STATUS_EFFECT, new Identifier("shitmod", "lean"), LEAN_EFFECT);
CustomPortalBuilder.beginPortal()
.frameBlock(Blocks.DIAMOND_BLOCK)
.lightWithItem(Items.ENDER_EYE)

View File

@ -1,5 +1,7 @@
{
"item.shitmod.fabric_item": "Penis",
"block.shitmod.fabric_block": "Gay Block",
"item.shitmod.hausbommer": "Hausbommer"
"item.shitmod.hausbommer": "Hausbommer",
"effect.shitmod.exp": "Experience",
"effect.shitmod.lean": "Lean"
}