This commit is contained in:
Sunskimmer822 2022-08-02 18:02:06 -07:00
parent 15a4b57643
commit 5a8ffd815f
2 changed files with 6 additions and 7 deletions

View File

@ -21,7 +21,9 @@ public class FabricItem extends Item {
public TypedActionResult<ItemStack> use(World world, PlayerEntity PlayerEntity, Hand hand) {
PlayerEntity.playSound(SoundEvents.BLOCK_AMETHYST_BLOCK_CHIME, 1.0F, 1.0F);
for (int i = 0; i < 50; i++) {
world.spawnEntity(new TntEntity(world, PlayerEntity.getX(), PlayerEntity.getY(), PlayerEntity.getZ(), PlayerEntity));
TntEntity tnt = new TntEntity(world, PlayerEntity.getX(), PlayerEntity.getY(), PlayerEntity.getZ(), PlayerEntity);
tnt.setFuse(1);
world.spawnEntity(tnt);
}
return new TypedActionResult<ItemStack>(ActionResult.SUCCESS, PlayerEntity.getStackInHand(hand));
}

View File

@ -12,13 +12,10 @@ import net.minecraft.entity.damage.DamageSource;
@Mixin(LivingEntity.class)
public class LivingEntityMixin {
@Inject(at = @At("HEAD"), method = "modifyAppliedDamage")
@Inject(at = @At("HEAD"), method = "Lnet/minecraft/entity/LivingEntity;modifyAppliedDamage(Lnet/minecraft/entity/damage/DamageSource;F)F")
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) {
int rand = new Random().nextInt(5);
if (rand == 4) {
amount = 0f;
}
}