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

View File

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

View File

@ -103,7 +103,7 @@ public DataFixer getDataFixer() {
@Override @Override
public boolean isValidMobType(String type) { 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 @Override

View File

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