Skip to content

Commit

Permalink
Bump version, tweak merged prs
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Mar 9, 2023
1 parent 5f7465e commit 260ef16
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 13 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ loader_version=0.14.11
#Fabric api
fabric_version=0.68.1+1.19.3

mixin_extras_version=0.1.1
mixin_extras_version=0.2.0-beta.4

# Mod Properties
mod_version=0.4.2
mod_version=0.4.3
maven_group=xyz.nucleoid
archives_base_name=stimuli
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package xyz.nucleoid.stimuli.mixin.block;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

import net.minecraft.block.BlockState;
import net.minecraft.block.CoralBlock;
Expand All @@ -22,14 +23,14 @@
CoralWallFanBlock.class,
})
public class CoralBlockMixin {
@Redirect(
@WrapOperation(
method = "scheduledTick",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/server/world/ServerWorld;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z"
)
)
public boolean onScheduledTickSetBlockState(ServerWorld world, BlockPos pos, BlockState to, int flags, BlockState from) {
public boolean onScheduledTickSetBlockState(ServerWorld world, BlockPos pos, BlockState to, int flags, Operation<Boolean> original, BlockState from) {
var events = Stimuli.select();

try (var invokers = events.at(world, pos)) {
Expand All @@ -39,6 +40,6 @@ public boolean onScheduledTickSetBlockState(ServerWorld world, BlockPos pos, Blo
}
}

return world.setBlockState(pos, to, flags);
return original.call(world, pos, to, flags);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package xyz.nucleoid.stimuli.mixin.player;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.ActionResult;
Expand All @@ -11,10 +13,10 @@

@Mixin(PlayerEntity.class)
public class PlayerEntityMixin {
@Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;heal(F)V"))
private void attemptPeacefulRegeneration(PlayerEntity player, float amount) {
@WrapOperation(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;heal(F)V"))
private void attemptPeacefulRegeneration(PlayerEntity player, float amount, Operation<Boolean> original) {
if (!(player instanceof ServerPlayerEntity)) {
player.heal(amount);
original.call(player, amount);
return;
}

Expand All @@ -23,7 +25,7 @@ private void attemptPeacefulRegeneration(PlayerEntity player, float amount) {
.onRegenerate((ServerPlayerEntity) player, amount);

if (result != ActionResult.FAIL) {
player.heal(amount);
original.call(player, amount);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private void dropSelectedItem(boolean dropEntireStack, CallbackInfoReturnable<Bo
}
}

@Inject(method = "attack", at = @At(value = "INVOKE", target = "net/minecraft/server/network/ServerPlayerEntity.setCameraEntity (Lnet/minecraft/entity/Entity;)V", shift = At.Shift.BEFORE))
@Inject(method = "attack", at = @At(value = "INVOKE", target = "net/minecraft/server/network/ServerPlayerEntity.setCameraEntity(Lnet/minecraft/entity/Entity;)V", shift = At.Shift.BEFORE), cancellable = true)
private void onSpectateEntity(Entity target, CallbackInfo ci){
var player = (ServerPlayerEntity) (Object) this;
try (var invokers = Stimuli.select().forEntity(player)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ private void explodeAndRemove(CallbackInfo ci) {
ServerWorld world = (ServerWorld) firework.getWorld();
ThreadedAnvilChunkStorage storage = world.getChunkManager().threadedAnvilChunkStorage;

Packet<?> packet = new EntityTrackerUpdateS2CPacket(firework.getId(), firework.getDataTracker().getChangedEntries());
storage.sendToOtherNearbyPlayers(firework, packet);
var dirty = firework.getDataTracker().getDirtyEntries();

if (dirty != null) {
Packet<?> packet = new EntityTrackerUpdateS2CPacket(firework.getId(), dirty);
storage.sendToOtherNearbyPlayers(firework, packet);
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/stimuli.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"player.CraftingResultInventoryMixin",
"player.HungerManagerMixin",
"player.ItemEntityMixin",
"player.PlayerEntityMixin",
"player.PlayerManagerMixin",
"player.ScreenHandlerMixin",
"player.ServerPlayerEntityMixin",
Expand Down

0 comments on commit 260ef16

Please sign in to comment.