Skip to content

Commit 593b34d

Browse files
committed
try fix #4
1 parent 0c97811 commit 593b34d

File tree

5 files changed

+15
-29
lines changed

5 files changed

+15
-29
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
## Changelog
2-
- fix permissionMixin
2+
- try fix #4

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ sourceCompatibility = JavaVersion.VERSION_21
88
targetCompatibility = JavaVersion.VERSION_21
99

1010
archivesBaseName = "$project.archives_base_name-${loom.getPlatform().get().id()}"
11-
version = "$project.mod_main_version+mc$project.minecraft_version"
11+
version = "$project.mod_version+mc$project.minecraft_version"
1212
group = project.maven_group
1313

1414
loom {

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ loom.platform = neoforge
99
parchment_mappings=2025.01.19
1010

1111
# Mod Properties
12-
mod_main_version = 0.1.2
13-
carpet_version = 1.4.147
12+
upstream_version = 1.4.147
13+
mod_version = 0.1.2
1414
maven_group = org.thinkingstudio.bedsheet
1515
archives_base_name = bedsheet
1616

src/main/java/carpet/mixins/ServerPlayer_scarpetEventMixin.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,15 @@ private void grabStat(Stat<?> stat, int amount, CallbackInfo ci)
7373
STATISTICS.onPlayerStatistic((ServerPlayer) (Object)this, stat, amount);
7474
}
7575

76-
// use LivingDeathEvent replace on NeoForge
77-
// @Inject(method = "die", at = @At("HEAD"))
78-
// private void onDeathEvent(DamageSource source, CallbackInfo ci)
79-
// {
80-
// ((EntityInterface)this).getEventContainer().onEvent(EntityEventsGroup.Event.ON_DEATH, source.getMsgId());
81-
// if (PLAYER_DIES.isNeeded())
82-
// {
83-
// PLAYER_DIES.onPlayerEvent((ServerPlayer) (Object)this);
84-
// }
85-
// }
76+
@Inject(method = "die", at = @At("HEAD"))
77+
private void onDeathEvent(DamageSource source, CallbackInfo ci)
78+
{
79+
((EntityInterface)this).getEventContainer().onEvent(EntityEventsGroup.Event.ON_DEATH, source.getMsgId());
80+
if (PLAYER_DIES.isNeeded())
81+
{
82+
PLAYER_DIES.onPlayerEvent((ServerPlayer) (Object)this);
83+
}
84+
}
8685

8786
private Vec3 previousLocation;
8887
private ResourceKey<Level> previousDimension;

src/main/java/org/thinkingstudio/bedsheet/BedSheetModEvents.java

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
package org.thinkingstudio.bedsheet;
22

33
import carpet.CarpetServer;
4-
import carpet.fakes.EntityInterface;
54
import carpet.network.CarpetClient;
6-
import carpet.script.EntityEventsGroup;
75
import net.minecraft.server.level.ServerPlayer;
86
import net.neoforged.bus.api.EventPriority;
97
import net.neoforged.bus.api.IEventBus;
108
import net.neoforged.neoforge.event.RegisterCommandsEvent;
11-
import net.neoforged.neoforge.event.entity.living.LivingDeathEvent;
129
import net.neoforged.neoforge.event.entity.living.LivingSwapItemsEvent;
1310
import net.neoforged.neoforge.event.entity.player.PlayerEvent;
1411
import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent;
1512
import net.neoforged.neoforge.network.registration.PayloadRegistrar;
1613

17-
import static carpet.script.CarpetEventServer.Event.PLAYER_DIES;
1814
import static carpet.script.CarpetEventServer.Event.PLAYER_SWAPS_HANDS;
1915

2016
public class BedSheetModEvents {
@@ -26,22 +22,13 @@ public static void registerEvents(IEventBus modEventBus, IEventBus forgeEventBus
2622
CarpetServer.onPlayerLoggedIn((ServerPlayer) event.getEntity());
2723
});
2824
forgeEventBus.addListener(EventPriority.HIGHEST, LivingSwapItemsEvent.Hands.class, event -> {
29-
if(PLAYER_SWAPS_HANDS.onPlayerEvent((ServerPlayer) event.getEntity())) {
30-
event.isCanceled();
31-
}
32-
});
33-
forgeEventBus.addListener(EventPriority.HIGHEST, LivingDeathEvent.class, event -> {
3425
if (event.getEntity() instanceof ServerPlayer serverPlayer) {
35-
((EntityInterface) serverPlayer).getEventContainer().onEvent(EntityEventsGroup.Event.ON_DEATH, event.getSource().getMsgId());
36-
if (PLAYER_DIES.isNeeded())
37-
{
38-
PLAYER_DIES.onPlayerEvent(serverPlayer);
26+
if (PLAYER_SWAPS_HANDS.onPlayerEvent(serverPlayer)) {
27+
event.isCanceled();
3928
}
4029
}
41-
((EntityInterface) event.getEntity()).getEventContainer().onEvent(EntityEventsGroup.Event.ON_DEATH, event.getSource().getMsgId());
4230
});
4331

44-
4532
modEventBus.addListener(EventPriority.HIGHEST, RegisterPayloadHandlersEvent.class, event -> {
4633
final PayloadRegistrar registrar = event.registrar(BedSheetModReference.MODID);
4734

0 commit comments

Comments
 (0)