Skip to content

Commit

Permalink
Remove redundant Scythe methods + NeoForge updated to 21.4.78-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
Starexify committed Jan 31, 2025
1 parent 811a00a commit f9cb90e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 49 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id 'java-library'
id 'maven-publish'
id 'net.neoforged.moddev' version '2.0.74'
id 'net.neoforged.moddev' version '2.0.76'
id 'idea'
}

Expand Down Expand Up @@ -60,7 +60,7 @@ neoForge {

mods {
"${mod_id}" {
sourceSet(sourceSets.main)
sourceSet sourceSets.main
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Gradle
org.gradle.configuration-cache=true
org.gradle.jvmargs=-Xmx1G
org.gradle.daemon=false
org.gradle.debug=false
Expand All @@ -12,7 +13,7 @@ parchment_mappings_version=2025.01.05
minecraft_version=1.21.4
minecraft_version_range=[1.21.4, 1.22)

neo_version=21.4.72-beta
neo_version=21.4.78-beta
neo_version_range=[21.4,)
loader_version_range=[4,)

Expand Down
46 changes: 0 additions & 46 deletions src/main/java/net/nova/big_swords/item/ScytheItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,50 +182,4 @@ public void postHurtEnemy(ItemStack stack, LivingEntity target, LivingEntity att
public boolean canAttackBlock(BlockState state, Level level, BlockPos pos, Player player) {
return !player.isCreative();
}

// Hoe-like Item Stuff
@Override
public InteractionResult useOn(UseOnContext context) {
Level level = context.getLevel();
BlockPos blockpos = context.getClickedPos();
BlockState toolModifiedState = level.getBlockState(blockpos).getToolModifiedState(context, ItemAbilities.HOE_TILL, false);
Pair<Predicate<UseOnContext>, Consumer<UseOnContext>> pair = toolModifiedState == null ? null : Pair.of(ctx -> true, changeIntoState(toolModifiedState));
if (pair == null) {
return InteractionResult.PASS;
} else {
Predicate<UseOnContext> predicate = pair.getFirst();
Consumer<UseOnContext> consumer = pair.getSecond();
if (predicate.test(context)) {
Player player = context.getPlayer();
level.playSound(player, blockpos, SoundEvents.HOE_TILL, SoundSource.BLOCKS, 1.0F, 1.0F);
if (!level.isClientSide) {
consumer.accept(context);
if (player != null) {
context.getItemInHand().hurtAndBreak(1, player, LivingEntity.getSlotForHand(context.getHand()));
}
}

return InteractionResult.SUCCESS;
} else {
return InteractionResult.PASS;
}
}
}

public static Consumer<UseOnContext> changeIntoState(BlockState state) {
return useOnContext -> {
useOnContext.getLevel().setBlock(useOnContext.getClickedPos(), state, 11);
useOnContext.getLevel().gameEvent(GameEvent.BLOCK_CHANGE, useOnContext.getClickedPos(), GameEvent.Context.of(useOnContext.getPlayer(), state));
};
}

@Override
public boolean hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker) {
return true;
}

@Override
public boolean canPerformAction(ItemStack stack, ItemAbility itemAbility) {
return ItemAbilities.DEFAULT_HOE_ACTIONS.contains(itemAbility);
}
}

0 comments on commit f9cb90e

Please sign in to comment.