Skip to content

Commit

Permalink
Added interaction event to fabric
Browse files Browse the repository at this point in the history
  • Loading branch information
Buuz135 committed Feb 1, 2024
1 parent b03bff4 commit d469580
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Expand Up @@ -2,6 +2,7 @@

import com.buuz135.findme.FindMeMod;
import com.buuz135.findme.network.PositionRequestMessage;
import dev.architectury.event.events.common.InteractionEvent;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.transfer.v1.item.ItemStorage;
import net.fabricmc.fabric.api.transfer.v1.item.ItemVariant;
Expand All @@ -12,6 +13,7 @@
import net.minecraft.core.Direction;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.item.ItemStack;

import java.util.Iterator;
Expand All @@ -37,7 +39,9 @@ public void onInitialize() {
return false;
});
FindMeMod.BLOCK_EXTRACTORS.add((entity, stack, amount, player) -> {
//TODO CHECK IF CAN BREAK THE BLOCK
if (InteractionEvent.RIGHT_CLICK_BLOCK.invoker().click(player, InteractionHand.MAIN_HAND, entity.getBlockPos(), Direction.UP).isFalse()) {
return 0;
}
try (Transaction transaction = Transaction.openOuter()) {
var playerInventory = PlayerInventoryStorage.of(player);
var totalExtracted = 0;
Expand Down Expand Up @@ -67,5 +71,6 @@ public void onInitialize() {
return totalExtracted;
}
});

}
}
5 changes: 5 additions & 0 deletions fabric/src/main/resources/findme.accesswidener
@@ -0,0 +1,5 @@
accessWidener v1 named

accessible method net/minecraft/client/particle/ParticleEngine register (Lnet/minecraft/core/particles/ParticleType;Lnet/minecraft/client/particle/ParticleProvider;)V
mutable field net/minecraft/client/particle/ParticleEngine RENDER_ORDER Ljava/util/List;
accessible field net/minecraft/client/particle/ParticleEngine RENDER_ORDER Ljava/util/List;
2 changes: 1 addition & 1 deletion gradle.properties
@@ -1,7 +1,7 @@
org.gradle.jvmargs=-Xmx4G
minecraft_version=1.20.1
archives_base_name=findme
mod_version=3.2.0
mod_version=3.2.1
maven_group=com.buuz135.findme
architectury_version=9.1.12
fabric_loader_version=0.14.21
Expand Down

0 comments on commit d469580

Please sign in to comment.