Skip to content

Commit

Permalink
Changed how the math maths
Browse files Browse the repository at this point in the history
  • Loading branch information
kckarnige committed Sep 25, 2024
1 parent b57bc0e commit 41d4310
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 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() - 120 == stack.getMaxDamage() - stack.getDamage()) {
if (stack.getMaxDamage() * 0.80 >= 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
3 changes: 1 addition & 2 deletions src/main/java/com/kckarnige/wham/mixin/MaceMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ public TypedActionResult<ItemStack> use(World world, PlayerEntity player, Hand h
if (hit.getType() == HitResult.Type.BLOCK) {
BlockHitResult blockHit = (BlockHitResult) hit;
if (Objects.equals(String.valueOf(blockHit.getSide()), "up")) {
if (!(player.getStackInHand(hand).getMaxDamage() - 120 == player.getStackInHand(hand).getMaxDamage() - player.getStackInHand(hand).getDamage())) {
wham.LOGGER.info(String.valueOf(player.getStackInHand(hand).getMaxDamage() - player.getStackInHand(hand).getDamage()+" of "+player.getStackInHand(hand).getMaxDamage()));
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));
Expand Down

0 comments on commit 41d4310

Please sign in to comment.