Add Forge DataFixer.

Unsure how useful this will be, but eh.
This commit is contained in:
wizjany 2019-05-17 19:39:18 -04:00
parent b0777f6b06
commit feed5173ec
3 changed files with 2739 additions and 0 deletions

View File

@ -57,6 +57,7 @@
<allow pkg="io.netty.buffer"/>
<allow pkg="org.spongepowered.api" />
<allow pkg="com.mojang.brigadier" />
<allow pkg="com.mojang.datafixers" />
</subpackage>
<subpackage name="sponge">

File diff suppressed because it is too large Load Diff

View File

@ -26,6 +26,7 @@ import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Capability;
import com.sk89q.worldedit.extension.platform.MultiUserPlatform;
import com.sk89q.worldedit.extension.platform.Preference;
import com.sk89q.worldedit.world.DataFixer;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.registry.Registries;
import net.minecraft.command.Commands;
@ -53,11 +54,13 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform {
private final ForgeWorldEdit mod;
private final MinecraftServer server;
private final ForgeDataFixer dataFixer;
private boolean hookingEvents = false;
ForgePlatform(ForgeWorldEdit mod) {
this.mod = mod;
this.server = ServerLifecycleHooks.getCurrentServer();
this.dataFixer = new ForgeDataFixer(getDataVersion());
}
boolean isHookingEvents() {
@ -75,6 +78,11 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform {
return 1631;
}
@Override
public DataFixer getDataFixer() {
return dataFixer;
}
@Override
public boolean isValidMobType(String type) {
return net.minecraftforge.registries.ForgeRegistries.ENTITIES.containsKey(new ResourceLocation(type));