[Forge] Update to 41.0.98 to fix breaking changes

Fixes #2139
This commit is contained in:
Octavia Togami 2022-07-13 19:35:12 -07:00
parent 8fee9bdd2c
commit 8caaa3e0ed
4 changed files with 15 additions and 16 deletions

View File

@ -16,7 +16,7 @@
val nextMajorMinecraftVersion: String = minecraftVersion.split('.').let { (useless, major) ->
"$useless.${major.toInt() + 1}"
}
val forgeVersion = "41.0.1"
val forgeVersion = "41.0.98"
val apiClasspath = configurations.create("apiClasspath") {
isCanBeResolved = true

View File

@ -53,7 +53,7 @@ public BaseEntity getState() {
if (entity == null || entity.isPassenger()) {
return null;
}
ResourceLocation id = ForgeRegistries.ENTITIES.getKey(entity.getType());
ResourceLocation id = ForgeRegistries.ENTITY_TYPES.getKey(entity.getType());
if (id == null) {
return null;
}

View File

@ -103,7 +103,7 @@ public DataFixer getDataFixer() {
@Override
public boolean isValidMobType(String type) {
return net.minecraftforge.registries.ForgeRegistries.ENTITIES.containsKey(new ResourceLocation(type));
return net.minecraftforge.registries.ForgeRegistries.ENTITY_TYPES.containsKey(new ResourceLocation(type));
}
@Override

View File

@ -89,7 +89,6 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static com.sk89q.worldedit.forge.ForgeAdapter.adaptPlayer;
import static com.sk89q.worldedit.internal.anvil.ChunkDeleter.DELCHUNKS_FILE_NAME;
import static java.util.stream.Collectors.toList;
/**
* The Forge implementation of WorldEdit.
@ -189,7 +188,7 @@ private void setupRegistries(MinecraftServer server) {
}
}
// Entities
for (ResourceLocation name : ForgeRegistries.ENTITIES.getKeys()) {
for (ResourceLocation name : ForgeRegistries.ENTITY_TYPES.getKeys()) {
if (EntityType.REGISTRY.get(name.toString()) == null) {
EntityType.REGISTRY.register(name.toString(), new EntityType(name.toString()));
}
@ -225,7 +224,7 @@ public void registerCommands(RegisterCommandsEvent event) {
}
List<Command> commands = manager.getPlatformCommandManager().getCommandManager()
.getAllCommands().collect(toList());
.getAllCommands().toList();
for (Command command : commands) {
CommandWrapper.register(event.getDispatcher(), command);
Set<String> perms = command.getCondition().as(PermissionCondition.class)
@ -270,7 +269,7 @@ public void onPlayerInteract(PlayerInteractEvent event) {
return; // We have to be told to catch these events
}
if (event.getWorld().isClientSide && event instanceof LeftClickEmpty) {
if (event.getLevel().isClientSide && event instanceof LeftClickEmpty) {
// catch LCE, pass it to server
InternalPacketHandler.getHandler().sendToServer(LeftClickAirEventMessage.INSTANCE);
return;
@ -288,8 +287,8 @@ public void onPlayerInteract(PlayerInteractEvent event) {
}
WorldEdit we = WorldEdit.getInstance();
ForgePlayer player = adaptPlayer((ServerPlayer) event.getPlayer());
ForgeWorld world = getWorld((ServerLevel) event.getPlayer().level);
ForgePlayer player = adaptPlayer((ServerPlayer) event.getEntity());
ForgeWorld world = getWorld((ServerLevel) event.getEntity().level);
Direction direction = ForgeAdapter.adaptEnumFacing(event.getFace());
if (event instanceof PlayerInteractEvent.LeftClickEmpty) {
@ -343,9 +342,9 @@ public void onCommandEvent(CommandEvent event) throws CommandSyntaxException {
@SubscribeEvent
public void onPlayerLogOut(PlayerEvent.PlayerLoggedOutEvent event) {
if (event.getPlayer() instanceof ServerPlayer) {
if (event.getEntity() instanceof ServerPlayer) {
WorldEdit.getInstance().getEventBus()
.post(new SessionIdleEvent(new ForgePlayer.SessionKeyImpl((ServerPlayer) event.getPlayer())));
.post(new SessionIdleEvent(new ForgePlayer.SessionKeyImpl((ServerPlayer) event.getEntity())));
}
}