This commit is contained in:
Sunskimmer822 2022-07-25 20:09:13 -07:00
parent dadedaed62
commit 336ed0f95c
10 changed files with 128 additions and 2 deletions

View File

@ -0,0 +1,25 @@
package net.serenas.shitmod;
import java.util.Random;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource;
@Mixin(LivingEntity.class)
public class LivingEntityMixin {
@Inject(at = @At("HEAD"), method = "modifyAppliedDamage")
private void injectMethod(DamageSource source, Float amount, CallbackInfo info) {
Random r = new Random();
int low = 1;
int high = 5;
int result = r.nextInt(high-low) + low;
if (result == 5) {
amount = 0f;
}
}
}

View File

@ -1,5 +1,6 @@
package net.serenas.shitmod;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.FireballEntity;
@ -22,8 +23,14 @@ public class blazeMetalAxe extends AxeItem {
Vec3d looking = PlayerEntity.getRotationVector();
World.spawnEntity(new FireballEntity(World, PlayerEntity, looking.x, looking.y, looking.z, 6));
PlayerEntity.getStackInHand(Hand).damage(100,PlayerEntity,e-> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND));
PlayerEntity.getItemCooldownManager().set(this, 40);
return new TypedActionResult<ItemStack>(ActionResult.SUCCESS, PlayerEntity.getStackInHand(Hand));
}
@Override
public void onCraft(ItemStack stack, World world, PlayerEntity player) {
stack.addEnchantment(Enchantments.FIRE_ASPECT, 2);
}
}

View File

@ -1,12 +1,21 @@
package net.serenas.shitmod;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.HoeItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ToolMaterial;
import net.minecraft.world.World;
public class blazeMetalHoe extends HoeItem {
public blazeMetalHoe(ToolMaterial material, int attackDamage, float attackSpeed, Settings settings) {
super(material, attackDamage, attackSpeed, settings);
}
@Override
public void onCraft(ItemStack stack, World world, PlayerEntity player) {
stack.addEnchantment(Enchantments.FIRE_ASPECT, 2);
}
}

View File

@ -1,10 +1,19 @@
package net.serenas.shitmod;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.PickaxeItem;
import net.minecraft.item.ToolMaterial;
import net.minecraft.world.World;
public class blazeMetalPickaxe extends PickaxeItem {
public blazeMetalPickaxe(ToolMaterial material, int attackDamage, float attackSpeed, Settings settings) {
super(material, attackDamage, attackSpeed, settings);
}
@Override
public void onCraft(ItemStack stack, World world, PlayerEntity player) {
stack.addEnchantment(Enchantments.FIRE_ASPECT, 2);
}
}

View File

@ -1,5 +1,6 @@
package net.serenas.shitmod;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.FireballEntity;
@ -22,8 +23,16 @@ public class blazeMetalSword extends SwordItem {
public TypedActionResult<ItemStack> use(World World, PlayerEntity PlayerEntity, Hand Hand) {
Vec3d looking = PlayerEntity.getRotationVector();
FireballEntity fireball = new FireballEntity(World, PlayerEntity, (2*looking.x), (2*looking.y), (2*looking.z), 5);
fireball.setOwner(PlayerEntity);
World.spawnEntity(fireball);
PlayerEntity.getStackInHand(Hand).damage(100,PlayerEntity,e-> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND));
PlayerEntity.getItemCooldownManager().set(this, 40);
return new TypedActionResult<ItemStack>(ActionResult.SUCCESS, PlayerEntity.getStackInHand(Hand));
}
@Override
public void onCraft(ItemStack stack, World world, PlayerEntity player) {
stack.addEnchantment(Enchantments.FIRE_ASPECT, 4);
}
}

View File

@ -1,11 +1,33 @@
package net.serenas.shitmod;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectCategory;
public class careFreeMelodyEffect extends StatusEffect {
protected careFreeMelodyEffect(StatusEffectCategory category, int color) {
super(category, color);
super(
StatusEffectCategory.BENEFICIAL, // whether beneficial or harmful for entities
0x98D982);
}
// 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) {
float damage = entity.getDamageTracker().getMostRecentDamage().getDamage();
float health = entity.getDamageTracker().getMostRecentDamage().getEntityHealth();
DamageSource source = entity.getDamageTracker().getMostRecentDamage().getDamageSource();
entity.getDamageTracker().onDamage(source, health, damage);
}
}

View File

@ -0,0 +1,25 @@
package net.serenas.shitmod;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
import net.minecraft.entity.passive.SheepEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.ActionResult;
public interface sheepShearCallback {
Event<sheepShearCallback> EVENT = EventFactory.createArrayBacked(sheepShearCallback.class,
(listeners) -> (player, sheep) -> {
for (sheepShearCallback listener : listeners) {
ActionResult result = listener.interact(player, sheep);
if(result != ActionResult.PASS) {
return result;
}
}
return ActionResult.PASS;
});
ActionResult interact(PlayerEntity player, SheepEntity sheep);
}

View File

@ -2,6 +2,7 @@ package net.serenas.shitmod;
import net.minecraft.block.BlockState;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.PickaxeItem;
@ -45,4 +46,9 @@ public class testHammer extends PickaxeItem {
return true;
}
@Override
public void onCraft(ItemStack stack, World world, PlayerEntity player) {
stack.addEnchantment(Enchantments.EFFICIENCY, 5);
}
}

View File

@ -23,7 +23,7 @@
]
},
"mixins": [
],
"depends": {

View File

@ -0,0 +1,14 @@
{
"required": true,
"minVersion": "0.8",
"package": "net.serenas.shitmod",
"compatibilityLevel": "JAVA_8",
"mixins": [
"LivingEntityMixin"
],
"client": [],
"server": [],
"injectors": {
"defaultRequire": 1
}
}