-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to 1.20.4, move some redirects to wrapoperation
- Loading branch information
Showing
14 changed files
with
104 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
# Done to increase the memory available to gradle. | ||
org.gradle.jvmargs=-Xmx1G | ||
|
||
minecraft_version=1.20.2 | ||
yarn_mappings=1.20.2+build.1 | ||
loader_version=0.14.22 | ||
minecraft_version=1.20.4 | ||
yarn_mappings=1.20.4+build.1 | ||
loader_version=0.15.0 | ||
|
||
#Fabric api | ||
fabric_version=0.89.0+1.20.2 | ||
|
||
mixin_extras_version=0.2.0-beta.9 | ||
fabric_version=0.91.1+1.20.4 | ||
|
||
# Mod Properties | ||
mod_version=0.4.9 | ||
mod_version=0.4.10 | ||
maven_group=xyz.nucleoid | ||
archives_base_name=stimuli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/main/java/xyz/nucleoid/stimuli/mixin/world/AbstractBlockMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package xyz.nucleoid.stimuli.mixin.world; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import com.llamalad7.mixinextras.sugar.Local; | ||
import net.minecraft.block.AbstractBlock; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.loot.context.LootContextParameterSet; | ||
import net.minecraft.server.world.ServerWorld; | ||
import net.minecraft.util.ActionResult; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.World; | ||
import net.minecraft.world.explosion.Explosion; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import xyz.nucleoid.stimuli.Stimuli; | ||
import xyz.nucleoid.stimuli.event.block.BlockDropItemsEvent; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
@Mixin(AbstractBlock.class) | ||
public class AbstractBlockMixin { | ||
@WrapOperation( | ||
method = "onExploded", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/block/BlockState;getDroppedStacks(Lnet/minecraft/loot/context/LootContextParameterSet$Builder;)Ljava/util/List;" | ||
) | ||
) | ||
private List<ItemStack> stimuli_dropBlock(BlockState state, LootContextParameterSet.Builder builder, Operation<List<ItemStack>> operation, | ||
@Local Explosion explosion, @Local World world) { | ||
var events = Stimuli.select(); | ||
final var entity = explosion.getEntity(); | ||
|
||
var pos = entity != null ? entity.getBlockPos() : BlockPos.ofFloored(explosion.getPosition()); | ||
try (var invokers = entity != null ? events.forEntityAt(entity, pos) : events.at(world, pos)) { | ||
var result = invokers.get(BlockDropItemsEvent.EVENT) | ||
.onDropItems(entity, (ServerWorld) world, pos, state, operation.call(state, builder)); | ||
|
||
if (result.getResult() != ActionResult.FAIL) { | ||
return result.getValue(); | ||
} else { | ||
return Collections.emptyList(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters