Update to Loom 0.10.0 and add Mixins

This commit is contained in:
shedaniel
2021-09-22 23:03:07 +08:00
parent 88dbf04c9b
commit c3ffa8d976
28 changed files with 123 additions and 126 deletions

View File

@@ -4,7 +4,7 @@ plugins {
}
loom {
accessWidener = file("src/main/resources/architectury.accessWidener")
accessWidenerPath = file("src/main/resources/architectury.accessWidener")
}
configurations {
@@ -30,10 +30,10 @@ dependencies {
modImplementation "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
modCompileOnly("com.terraformersmc:modmenu:${rootProject.mod_menu_version}") { transitive false }
implementation(project(path: ":common")) {
implementation(project(path: ":common", configuration: "dev")) {
transitive = false
}
developmentFabric(project(path: ":common")) {
developmentFabric(project(path: ":common", configuration: "dev")) {
transitive = false
}
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) {

View File

@@ -0,0 +1,33 @@
package dev.architectury.mixin.fabric;
import dev.architectury.event.events.common.BlockEvent;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.item.FallingBlockEntity;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
@Mixin(FallingBlockEntity.class)
public abstract class MixinFallingBlockEntity extends Entity {
public MixinFallingBlockEntity(EntityType<?> entityType, Level level) {
super(entityType, level);
}
@Shadow
private BlockState blockState;
@Inject(method = "tick", at = @At(value = "INVOKE",
target = "Lnet/minecraft/world/level/block/Fallable;onLand(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/entity/item/FallingBlockEntity;)V"),
locals = LocalCapture.CAPTURE_FAILHARD)
public void handleLand(CallbackInfo ci, Block block, BlockPos blockPos2, boolean bl, boolean bl2, BlockState blockState) {
BlockEvent.FALLING_LAND.invoker().onLand(this.level, blockPos2, this.blockState, blockState, (FallingBlockEntity) (Object) this);
}
}

View File

@@ -33,6 +33,7 @@
"MixinDedicatedServer",
"MixinEntity",
"MixinExplosion",
"MixinFallingBlockEntity",
"MixinFarmBlock",
"MixinFurnaceResultSlot",
"MixinInventory",