stuff
This commit is contained in:
parent
dadedaed62
commit
336ed0f95c
25
src/main/java/net/serenas/shitmod/LivingEntityMixin.java
Normal file
25
src/main/java/net/serenas/shitmod/LivingEntityMixin.java
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package net.serenas.shitmod;
|
package net.serenas.shitmod;
|
||||||
|
|
||||||
|
import net.minecraft.enchantment.Enchantments;
|
||||||
import net.minecraft.entity.EquipmentSlot;
|
import net.minecraft.entity.EquipmentSlot;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.projectile.FireballEntity;
|
import net.minecraft.entity.projectile.FireballEntity;
|
||||||
@ -22,8 +23,14 @@ public class blazeMetalAxe extends AxeItem {
|
|||||||
Vec3d looking = PlayerEntity.getRotationVector();
|
Vec3d looking = PlayerEntity.getRotationVector();
|
||||||
World.spawnEntity(new FireballEntity(World, PlayerEntity, looking.x, looking.y, looking.z, 6));
|
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.getStackInHand(Hand).damage(100,PlayerEntity,e-> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND));
|
||||||
|
PlayerEntity.getItemCooldownManager().set(this, 40);
|
||||||
return new TypedActionResult<ItemStack>(ActionResult.SUCCESS, PlayerEntity.getStackInHand(Hand));
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,21 @@
|
|||||||
package net.serenas.shitmod;
|
package net.serenas.shitmod;
|
||||||
|
|
||||||
|
import net.minecraft.enchantment.Enchantments;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.HoeItem;
|
import net.minecraft.item.HoeItem;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.ToolMaterial;
|
import net.minecraft.item.ToolMaterial;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class blazeMetalHoe extends HoeItem {
|
public class blazeMetalHoe extends HoeItem {
|
||||||
|
|
||||||
public blazeMetalHoe(ToolMaterial material, int attackDamage, float attackSpeed, Settings settings) {
|
public blazeMetalHoe(ToolMaterial material, int attackDamage, float attackSpeed, Settings settings) {
|
||||||
super(material, attackDamage, attackSpeed, settings);
|
super(material, attackDamage, attackSpeed, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCraft(ItemStack stack, World world, PlayerEntity player) {
|
||||||
|
stack.addEnchantment(Enchantments.FIRE_ASPECT, 2);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,19 @@
|
|||||||
package net.serenas.shitmod;
|
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.PickaxeItem;
|
||||||
import net.minecraft.item.ToolMaterial;
|
import net.minecraft.item.ToolMaterial;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class blazeMetalPickaxe extends PickaxeItem {
|
public class blazeMetalPickaxe extends PickaxeItem {
|
||||||
public blazeMetalPickaxe(ToolMaterial material, int attackDamage, float attackSpeed, Settings settings) {
|
public blazeMetalPickaxe(ToolMaterial material, int attackDamage, float attackSpeed, Settings settings) {
|
||||||
super(material, attackDamage, attackSpeed, settings);
|
super(material, attackDamage, attackSpeed, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCraft(ItemStack stack, World world, PlayerEntity player) {
|
||||||
|
stack.addEnchantment(Enchantments.FIRE_ASPECT, 2);
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package net.serenas.shitmod;
|
package net.serenas.shitmod;
|
||||||
|
|
||||||
|
import net.minecraft.enchantment.Enchantments;
|
||||||
import net.minecraft.entity.EquipmentSlot;
|
import net.minecraft.entity.EquipmentSlot;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.projectile.FireballEntity;
|
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) {
|
public TypedActionResult<ItemStack> use(World World, PlayerEntity PlayerEntity, Hand Hand) {
|
||||||
Vec3d looking = PlayerEntity.getRotationVector();
|
Vec3d looking = PlayerEntity.getRotationVector();
|
||||||
FireballEntity fireball = new FireballEntity(World, PlayerEntity, (2*looking.x), (2*looking.y), (2*looking.z), 5);
|
FireballEntity fireball = new FireballEntity(World, PlayerEntity, (2*looking.x), (2*looking.y), (2*looking.z), 5);
|
||||||
|
fireball.setOwner(PlayerEntity);
|
||||||
World.spawnEntity(fireball);
|
World.spawnEntity(fireball);
|
||||||
PlayerEntity.getStackInHand(Hand).damage(100,PlayerEntity,e-> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND));
|
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));
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,33 @@
|
|||||||
package net.serenas.shitmod;
|
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.StatusEffect;
|
||||||
import net.minecraft.entity.effect.StatusEffectCategory;
|
import net.minecraft.entity.effect.StatusEffectCategory;
|
||||||
|
|
||||||
public class careFreeMelodyEffect extends StatusEffect {
|
public class careFreeMelodyEffect extends StatusEffect {
|
||||||
|
|
||||||
protected careFreeMelodyEffect(StatusEffectCategory category, int color) {
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
25
src/main/java/net/serenas/shitmod/sheepShearCallback.java
Normal file
25
src/main/java/net/serenas/shitmod/sheepShearCallback.java
Normal 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);
|
||||||
|
}
|
@ -2,6 +2,7 @@ package net.serenas.shitmod;
|
|||||||
|
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.enchantment.Enchantments;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.PickaxeItem;
|
import net.minecraft.item.PickaxeItem;
|
||||||
@ -45,4 +46,9 @@ public class testHammer extends PickaxeItem {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCraft(ItemStack stack, World world, PlayerEntity player) {
|
||||||
|
stack.addEnchantment(Enchantments.EFFICIENCY, 5);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"mixins": [
|
"mixins": [
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
"depends": {
|
"depends": {
|
||||||
|
14
src/main/resources/serenas-shitmod.mixins.json
Normal file
14
src/main/resources/serenas-shitmod.mixins.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"required": true,
|
||||||
|
"minVersion": "0.8",
|
||||||
|
"package": "net.serenas.shitmod",
|
||||||
|
"compatibilityLevel": "JAVA_8",
|
||||||
|
"mixins": [
|
||||||
|
"LivingEntityMixin"
|
||||||
|
],
|
||||||
|
"client": [],
|
||||||
|
"server": [],
|
||||||
|
"injectors": {
|
||||||
|
"defaultRequire": 1
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user