3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-03 01:50:07 +01:00

Further work on Forge 1.13 compat.

Dieser Commit ist enthalten in:
Matthew Miller 2018-12-15 22:13:13 +10:00
Ursprung 11cf5377d9
Commit 7a08098b03
12 geänderte Dateien mit 89 neuen und 74 gelöschten Zeilen

Datei anzeigen

@ -2,7 +2,7 @@ buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url = "http://files.minecraftforge.net/maven" }
maven { url = "https://files.minecraftforge.net/maven" }
jcenter()
}
@ -14,7 +14,7 @@ buildscript {
apply plugin: 'net.minecraftforge.gradle'
def minecraftVersion = "1.13"
def forgeVersion = "24.0.16-1.13-pre"
def forgeVersion = "24.0.32-1.13-pre"
dependencies {
compile project(':worldedit-core')
@ -28,26 +28,28 @@ sourceCompatibility = 1.8
targetCompatibility = 1.8
minecraft {
mappings channel: 'snapshot', version: '20181215'
// runDir = 'run'
// replaceIn "com/sk89q/worldedit/forge/ForgeWorldEdit.java"
// replace "%VERSION%", project.version
mappings channel: 'snapshot', version: '20180921-1.13'
}
project.archivesBaseName = "${project.archivesBaseName}-mc${minecraftVersion}"
processResources {
from (sourceSets.main.resources.srcDirs) {
expand 'version': project.version,
'mcVersion': minecraftVersion,
'forgeVersion': forgeVersion,
'internalVersion': project.internalVersion
include 'mcmod.info'
// this will ensure that this task is redone when the versions change.
inputs.property 'version', project.version
inputs.property 'mcversion', minecraftVersion
inputs.property 'internalVersion', internalVersion
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'META_INF/mods.toml'
// replace version and mcversion
expand 'version':project.version, 'mcversion': minecraftVersion, 'internalVersion': internalVersion
}
from (sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
// copy everything else except the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'META_INF/mods.toml'
}
}

Datei anzeigen

@ -63,12 +63,12 @@ public class ForgeBlockMaterial extends PassthroughBlockMaterial {
@Override
public boolean isFragileWhenPushed() {
return delegate.getMobilityFlag() == EnumPushReaction.DESTROY;
return delegate.getPushReaction() == EnumPushReaction.DESTROY;
}
@Override
public boolean isUnpushable() {
return delegate.getMobilityFlag() == EnumPushReaction.BLOCK;
return delegate.getPushReaction() == EnumPushReaction.BLOCK;
}
@Override
@ -78,7 +78,7 @@ public class ForgeBlockMaterial extends PassthroughBlockMaterial {
@Override
public boolean isBurnable() {
return delegate.getCanBurn();
return delegate.isFlammable();
}
@Override

Datei anzeigen

@ -136,7 +136,7 @@ public class ForgeEntityProperties implements EntityProperties {
@Override
public boolean isTagged() {
return entity instanceof EntityLiving && ((EntityLiving) entity).hasCustomName();
return entity.hasCustomName();
}
@Override

Datei anzeigen

@ -44,10 +44,10 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.CommandEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickEmpty;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
@ -56,7 +56,8 @@ import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent;
import net.minecraftforge.fml.common.event.FMLServerStartedEvent;
import net.minecraftforge.fml.common.event.FMLServerStoppingEvent;
import net.minecraftforge.fml.common.eventhandler.Event.Result;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.javafmlmod.FMLModLoadingContext;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
@ -64,16 +65,15 @@ import java.io.File;
/**
* The Forge implementation of WorldEdit.
*/
@Mod(modid = ForgeWorldEdit.MOD_ID, name = "WorldEdit", version = "%VERSION%", acceptableRemoteVersions = "*")
@Mod(ForgeWorldEdit.MOD_ID)
public class ForgeWorldEdit {
public static Logger logger;
private static final Logger LOGGER = LogManager.getLogger();
public static final String MOD_ID = "worldedit";
public static final String CUI_PLUGIN_CHANNEL = "worldedit:cui";
private ForgePermissionsProvider provider;
@Instance(MOD_ID)
public static ForgeWorldEdit inst;
@SidedProxy(serverSide = "com.sk89q.worldedit.forge.CommonProxy", clientSide = "com.sk89q.worldedit.forge.ClientProxy")
@ -83,36 +83,42 @@ public class ForgeWorldEdit {
private ForgeConfiguration config;
private File workingDir;
@EventHandler
public ForgeWorldEdit() {
inst = this;
FMLModLoadingContext.get().getModEventBus().addListener(this::preInit);
FMLModLoadingContext.get().getModEventBus().addListener(this::init);
FMLModLoadingContext.get().getModEventBus().addListener(this::postInit);
FMLModLoadingContext.get().getModEventBus().addListener(this::serverAboutToStart);
FMLModLoadingContext.get().getModEventBus().addListener(this::serverStopping);
FMLModLoadingContext.get().getModEventBus().addListener(this::serverStarted);
MinecraftForge.EVENT_BUS.register(ThreadSafeCache.getInstance());
MinecraftForge.EVENT_BUS.register(this);
}
public void preInit(FMLPreInitializationEvent event) {
logger = event.getModLog();
// Setup working directory
workingDir = new File(event.getModConfigurationDirectory() + File.separator + "worldedit");
workingDir.mkdir();
config = new ForgeConfiguration(this);
config.load();
MinecraftForge.EVENT_BUS.register(ThreadSafeCache.getInstance());
}
@EventHandler
public void init(FMLInitializationEvent event) {
MinecraftForge.EVENT_BUS.register(this);
WECUIPacketHandler.init();
InternalPacketHandler.init();
proxy.registerHandlers();
}
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
logger.info("WorldEdit for Forge (version " + getInternalVersion() + ") is loaded");
LOGGER.info("WorldEdit for Forge (version " + getInternalVersion() + ") is loaded");
}
@EventHandler
public void serverAboutToStart(FMLServerAboutToStartEvent event) {
if (this.platform != null) {
logger.warn("FMLServerStartingEvent occurred when FMLServerStoppingEvent hasn't");
LOGGER.warn("FMLServerStartingEvent occurred when FMLServerStoppingEvent hasn't");
WorldEdit.getInstance().getPlatformManager().unregister(platform);
}
@ -141,14 +147,12 @@ public class ForgeWorldEdit {
}
}
@EventHandler
public void serverStopping(FMLServerStoppingEvent event) {
WorldEdit worldEdit = WorldEdit.getInstance();
worldEdit.getSessionManager().unload();
worldEdit.getPlatformManager().unregister(platform);
}
@EventHandler
public void serverStarted(FMLServerStartedEvent event) {
WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent());
}
@ -183,11 +187,11 @@ public class ForgeWorldEdit {
boolean isLeftDeny = event instanceof PlayerInteractEvent.LeftClickBlock
&& ((PlayerInteractEvent.LeftClickBlock) event)
.getUseItem() == Result.DENY;
.getUseItem() == Event.Result.DENY;
boolean isRightDeny =
event instanceof PlayerInteractEvent.RightClickBlock
&& ((PlayerInteractEvent.RightClickBlock) event)
.getUseItem() == Result.DENY;
.getUseItem() == Event.Result.DENY;
if (isLeftDeny || isRightDeny || event.getEntity().world.isRemote) {
return;
}
@ -233,7 +237,7 @@ public class ForgeWorldEdit {
if (item.getNbtData() != null) {
forgeCompound = NBTConverter.toNative(item.getNbtData());
}
return new ItemStack(Item.getByNameOrId(item.getType().getId()), item.getAmount(), 0, forgeCompound);
return new ItemStack(Item.REGISTRY.get(new ResourceLocation(item.getType().getId())), item.getAmount(), 0, forgeCompound);
}
/**

Datei anzeigen

@ -20,18 +20,19 @@
package com.sk89q.worldedit.forge;
import com.sk89q.worldedit.forge.net.LeftClickAirEventMessage;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import net.minecraftforge.fml.relauncher.Side;
import javafx.geometry.Side;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.network.NetworkRegistry;
import net.minecraftforge.fml.network.simple.SimpleChannel;
import java.nio.charset.Charset;
public class InternalPacketHandler {
public static final Charset UTF_8_CHARSET = Charset.forName("UTF-8");
public static SimpleNetworkWrapper CHANNEL;
public static SimpleChannel CHANNEL;
public static void init() {
CHANNEL = NetworkRegistry.INSTANCE.newSimpleChannel(ForgeWorldEdit.MOD_ID);
CHANNEL = NetworkRegistry.newSimpleChannel(new ResourceLocation(ForgeWorldEdit.MOD_ID, "worldedit"), () -> "1", check -> true, check -> true);
CHANNEL.registerMessage(LeftClickAirEventMessage.Handler.class, LeftClickAirEventMessage.class, 0, Side.SERVER);
}

Datei anzeigen

@ -22,14 +22,14 @@ package com.sk89q.worldedit.forge;
import com.sk89q.worldedit.forge.gui.GuiHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.KeyBinding;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent;
import org.lwjgl.input.Keyboard;
public class KeyHandler {
private static Minecraft mc = Minecraft.getMinecraft();
private static Minecraft mc = Minecraft.getInstance();
private static KeyBinding mainKey = new KeyBinding("WorldEdit Reference", Keyboard.KEY_L, "WorldEdit");
public KeyHandler() {

Datei anzeigen

@ -21,8 +21,7 @@ package com.sk89q.worldedit.forge;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.MinecraftServer;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import java.util.Collections;

Datei anzeigen

@ -81,7 +81,7 @@ final class TileEntityUtils {
if (tag != null) {
// Set X, Y, Z
updateForSet(tag, position);
tileEntity.readFromNBT(tag);
tileEntity.read(tag);
}
world.setTileEntity(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()), tileEntity);
@ -98,7 +98,7 @@ final class TileEntityUtils {
static void setTileEntity(World world, BlockVector3 position, @Nullable NBTTagCompound tag) {
if (tag != null) {
updateForSet(tag, position);
TileEntity tileEntity = TileEntity.create(world, tag);
TileEntity tileEntity = TileEntity.create(tag);
if (tileEntity != null) {
world.setTileEntity(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()), tileEntity);
}
@ -143,7 +143,7 @@ final class TileEntityUtils {
public static NBTTagCompound copyNbtData(TileEntity tile) {
NBTTagCompound tag = new NBTTagCompound();
tile.writeToNBT(tag);
tile.write(tag);
return tag;
}
}

Datei anzeigen

@ -25,7 +25,7 @@ import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.ThreadQuickExitException;
import net.minecraft.network.play.server.SPacketCustomPayload;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.network.FMLEventChannel;
import net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientCustomPacketEvent;
import net.minecraftforge.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;

Datei anzeigen

@ -0,0 +1,30 @@
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml"
# A version range to match for said mod loader - for regular FML @Mod it will be the minecraft version (without the 1.)
loaderVersion="[13,)"
# A URL to refer people to when problems occur with this mod
issueTrackerURL="https://discord.gg/YKbmj7V"
# A URL for the "homepage" for this mod, displayed in the mod UI
displayURL="http://wiki.sk89q.com/wiki/WorldEdit/"
# A file name (in the root of the mod JAR) containing a logo for display
logoFile="worldedit-icon.png"
# A text field displayed in the mod UI
authors="sk89q, wizjany, TomyLobo, kenzierocks, Me4502"
# A list of mods - how many allowed here is determined by the individual mod loader
[[worldedit]]
# The modid of the mod
modId="worldedit"
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
version="${internalVersion}"
# A display name for the mod
displayName="WorldEdit"
# The description text for the mod (multi line!)
description='''
WorldEdit is an easy-to-use in-game world editor for Minecraft, supporting both single player and multiplayer.
'''
[[dependencies.sponge]]
modId="sponge"
mandatory=false
versionRange="[1.13]"
ordering="NONE"
side="BOTH"

Datei anzeigen

@ -1,21 +0,0 @@
[{
"modid": "worldedit",
"name": "WorldEdit",
"description": "WorldEdit is an easy-to-use in-game world editor for Minecraft, supporting both single player and multiplayer.",
"version": "${internalVersion}",
"mcversion": "${mcVersion}",
"url": "http://wiki.sk89q.com/wiki/WorldEdit",
"updateUrl": "",
"authors": [ "sk89q", "wizjany", "TomyLobo", "kenzierocks", "Me4502" ],
"credits": "",
"logoFile": "",
"screenshots": [],
"requiredMods": [
"Forge@[${forgeVersion},)"
],
"dependencies": [
"Forge@[${forgeVersion},)",
"sponge"
],
"dependants": []
}]

Binäre Datei nicht angezeigt.

Nachher

Breite:  |  Höhe:  |  Größe: 5.5 KiB