Skip to content

Commit

Permalink
Upped damage and changed how bounce works
Browse files Browse the repository at this point in the history
  • Loading branch information
kckarnige committed Sep 26, 2024
1 parent 41d4310 commit ddc8930
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public abstract class ItemRendererMixin {
@ModifyVariable(method = "renderItem", at = @At(value = "HEAD"), argsOnly = true)
public BakedModel useMaceModel(BakedModel value, ItemStack stack, ModelTransformationMode renderMode, boolean leftHanded, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
if (stack.isOf(Items.MACE) && renderMode != ModelTransformationMode.GUI && renderMode != ModelTransformationMode.GROUND && renderMode != ModelTransformationMode.FIXED) {
if (stack.getMaxDamage() * 0.80 >= stack.getMaxDamage() - stack.getDamage()) {
if (stack.getMaxDamage() * 0.70 >= stack.getMaxDamage() - stack.getDamage()) {
return ((ItemRendererAccessor) this).macebut3d$getModels().getModelManager().getModel(ModelIdentifier.ofInventoryVariant(Identifier.of(MOD_ID, "mace_hand")));
} else {
return ((ItemRendererAccessor) this).macebut3d$getModels().getModelManager().getModel(ModelIdentifier.ofInventoryVariant(Identifier.of(MOD_ID, "mace_hand_wind")));
Expand Down
25 changes: 12 additions & 13 deletions src/main/java/com/kckarnige/wham/mixin/MaceMixin.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
package com.kckarnige.wham.mixin;

import com.kckarnige.wham.wham;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.WindChargeEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.MaceItem;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.Hand;
import net.minecraft.util.Identifier;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.hit.HitResult;
Expand All @@ -32,15 +27,19 @@ public MaceMixin(Settings settings) {
public TypedActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) {
if (!world.isClient()) {
if (Objects.equals(String.valueOf(player.getFacing()), "down")) {
HitResult hit = player.raycast(2, 0, false); // 20 is distance used by the DebugHud for "looking at block", false means ignore fluids
HitResult hit = player.raycast(2.5, 0, false); // 20 is distance used by the DebugHud for "looking at block", false means ignore fluids
if (hit.getType() == HitResult.Type.BLOCK) {
BlockHitResult blockHit = (BlockHitResult) hit;
if (Objects.equals(String.valueOf(blockHit.getSide()), "up")) {
if (!(player.getStackInHand(hand).getMaxDamage() * 0.80 >= player.getStackInHand(hand).getMaxDamage() - player.getStackInHand(hand).getDamage())) {
world.playSound(null, player.getBlockPos(), SoundEvent.of(Identifier.of("minecraft:entity.wind_charge.wind_burst")), SoundCategory.PLAYERS);
world.addParticle(ParticleTypes.HEART, player.getX(), player.getY() + 2.0, player.getZ(), 0.0, 0.0, 0.0);
player.addStatusEffect(new StatusEffectInstance(StatusEffects.LEVITATION, 4, 20, false, false, false));
player.getStackInHand(hand).damage(40, player, LivingEntity.getSlotForHand(hand));
if (!(player.getStackInHand(hand).getMaxDamage() * 0.70 >= player.getStackInHand(hand).getMaxDamage() - player.getStackInHand(hand).getDamage())) {
player.getItemCooldownManager().set(this, 10);

WindChargeEntity windCharge = new WindChargeEntity(EntityType.WIND_CHARGE, world);
windCharge.setPosition(player.getPos());
windCharge.setVelocity(0.0,-2.0,0.0);
world.spawnEntity(windCharge);

player.getStackInHand(hand).damage(60, player, LivingEntity.getSlotForHand(hand));
return TypedActionResult.success(player.getStackInHand(hand));
}
}
Expand Down

0 comments on commit ddc8930

Please sign in to comment.