Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-08 04:20:06 +01:00
Merge branch 'feature/forge1.8'
Dieser Commit ist enthalten in:
Commit
219d2da0ff
@ -10,7 +10,7 @@ jdk:
|
|||||||
- openjdk6
|
- openjdk6
|
||||||
# Caching for Gradle files, prevents hitting Maven too much.
|
# Caching for Gradle files, prevents hitting Maven too much.
|
||||||
before_cache:
|
before_cache:
|
||||||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
- find $HOME/.gradle/ -name '*.lock' -print -exec rm -f {} \;
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
- $HOME/.gradle/caches/
|
- $HOME/.gradle/caches/
|
||||||
|
34
build.gradle
34
build.gradle
@ -26,9 +26,9 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.0'
|
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3'
|
||||||
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:3.0.1'
|
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:3.0.1'
|
||||||
classpath 'org.ajoberstar:gradle-git:0.12.0'
|
classpath 'org.ajoberstar:gradle-git:1.4.2'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,14 +36,19 @@ if (!project.hasProperty("artifactory_contextUrl")) ext.artifactory_contextUrl =
|
|||||||
if (!project.hasProperty("artifactory_user")) ext.artifactory_user = "guest"
|
if (!project.hasProperty("artifactory_user")) ext.artifactory_user = "guest"
|
||||||
if (!project.hasProperty("artifactory_password")) ext.artifactory_password = ""
|
if (!project.hasProperty("artifactory_password")) ext.artifactory_password = ""
|
||||||
|
|
||||||
if (!project.hasProperty("gitCommitHash")) {
|
if (!project.hasProperty("gitCommitHash") && !JavaVersion.current().isJava6()) {
|
||||||
try {
|
try {
|
||||||
def repo = Grgit.open(project.file('.'))
|
def Grgit = Class.forName("org.ajoberstar.grgit.Grgit");
|
||||||
|
def Grgit_open = Grgit.getDeclaredMethod("open", File.class)
|
||||||
|
def repo = Grgit_open.invoke(null, project.file('.'))
|
||||||
ext.gitCommitHash = repo.head().abbreviatedId
|
ext.gitCommitHash = repo.head().abbreviatedId
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ext.gitCommitHash = "no_git_id"
|
println "Error getting commit hash: " + e.getMessage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!project.hasProperty("gitCommitHash")) {
|
||||||
|
ext.gitCommitHash = "no_git_id"
|
||||||
|
}
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
@ -75,11 +80,6 @@ subprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
||||||
classifier = 'sources'
|
|
||||||
from sourceSets.main.allSource
|
|
||||||
}
|
|
||||||
|
|
||||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||||
classifier = 'javadoc'
|
classifier = 'javadoc'
|
||||||
from javadoc.destinationDir
|
from javadoc.destinationDir
|
||||||
@ -87,13 +87,23 @@ subprojects {
|
|||||||
|
|
||||||
artifacts {
|
artifacts {
|
||||||
archives jar
|
archives jar
|
||||||
archives sourcesJar
|
|
||||||
archives javadocJar
|
archives javadocJar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!name.equals('worldedit-forge')) {
|
||||||
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||||
|
classifier = 'sources'
|
||||||
|
from sourceSets.main.allSource
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
archives sourcesJar
|
||||||
|
}
|
||||||
|
build.dependsOn(sourcesJar)
|
||||||
|
}
|
||||||
|
|
||||||
build.dependsOn(checkstyleMain)
|
build.dependsOn(checkstyleMain)
|
||||||
build.dependsOn(checkstyleTest)
|
build.dependsOn(checkstyleTest)
|
||||||
build.dependsOn(sourcesJar)
|
|
||||||
build.dependsOn(javadocJar)
|
build.dependsOn(javadocJar)
|
||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
|
@ -48,13 +48,14 @@
|
|||||||
</subpackage>
|
</subpackage>
|
||||||
|
|
||||||
<subpackage name="forge">
|
<subpackage name="forge">
|
||||||
<allow pkg="codechicken.multipart"/>
|
|
||||||
<allow pkg="cpw"/>
|
<allow pkg="cpw"/>
|
||||||
<allow pkg="net.minecraft"/>
|
<allow pkg="net.minecraft"/>
|
||||||
<allow pkg="net.minecraftforge"/>
|
<allow pkg="net.minecraftforge"/>
|
||||||
<allow pkg="com.mojang.authlib"/>
|
<allow pkg="com.mojang.authlib"/>
|
||||||
<allow pkg="org.apache.logging.log4j"/>
|
<allow pkg="org.apache.logging.log4j"/>
|
||||||
<allow pkg="org.lwjgl"/>
|
<allow pkg="org.lwjgl"/>
|
||||||
|
<allow pkg="io.netty.buffer"/>
|
||||||
|
<allow pkg="org.spongepowered.api" />
|
||||||
</subpackage>
|
</subpackage>
|
||||||
</subpackage>
|
</subpackage>
|
||||||
</import-control>
|
</import-control>
|
||||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binäre Datei nicht angezeigt.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
|||||||
#Mon Apr 07 22:45:51 PDT 2014
|
#Mon Feb 22 17:40:44 PST 2016
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=http\://services.gradle.org/distributions/gradle-2.0-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-bin.zip
|
||||||
|
10
gradlew
vendored
10
gradlew
vendored
@ -42,11 +42,6 @@ case "`uname`" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
|
||||||
if $cygwin ; then
|
|
||||||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
# Attempt to set APP_HOME
|
||||||
# Resolve links: $0 may be a link
|
# Resolve links: $0 may be a link
|
||||||
PRG="$0"
|
PRG="$0"
|
||||||
@ -61,9 +56,9 @@ while [ -h "$PRG" ] ; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
SAVED="`pwd`"
|
SAVED="`pwd`"
|
||||||
cd "`dirname \"$PRG\"`/" >&-
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
APP_HOME="`pwd -P`"
|
APP_HOME="`pwd -P`"
|
||||||
cd "$SAVED" >&-
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
@ -114,6 +109,7 @@ fi
|
|||||||
if $cygwin ; then
|
if $cygwin ; then
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
2
gradlew.bat
vendored
2
gradlew.bat
vendored
@ -46,7 +46,7 @@ echo location of your Java installation.
|
|||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:init
|
:init
|
||||||
@rem Get command-line arguments, handling Windowz variants
|
@rem Get command-line arguments, handling Windows variants
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||||
|
@ -7,28 +7,33 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
|
classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'forge'
|
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
name 'forge'
|
|
||||||
url 'http://files.minecraftforge.net/maven/'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':worldedit-core')
|
compile project(':worldedit-core')
|
||||||
compile group: 'codechicken', name: 'ForgeMultipart', version: '1.7.10-1.2.0.345', classifier: 'dev'
|
compile 'org.spongepowered:spongeapi:3.1.0-SNAPSHOT'
|
||||||
testCompile group: 'org.mockito', name: 'mockito-core', version: '1.9.0-rc1'
|
testCompile group: 'org.mockito', name: 'mockito-core', version: '1.9.0-rc1'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = "Sponge"
|
||||||
|
url = "https://repo.spongepowered.org/maven"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
version = "6.1.1"
|
||||||
|
ext.forgeVersion = "11.15.1.1760"
|
||||||
|
ext.internalVersion = version + ";" + gitCommitHash
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
ext.forgeVersion = "10.13.4.1614-1.7.10"
|
version = "1.8.9-${project.forgeVersion}"
|
||||||
version = "1.7.10-$forgeVersion"
|
mappings = "snapshot_20160111"
|
||||||
|
runDir = 'run'
|
||||||
|
|
||||||
replaceIn "com/sk89q/worldedit/forge/ForgeWorldEdit.java"
|
replaceIn "com/sk89q/worldedit/forge/ForgeWorldEdit.java"
|
||||||
replace "%VERSION%", project.version
|
replace "%VERSION%", project.version
|
||||||
@ -40,7 +45,7 @@ processResources {
|
|||||||
from (sourceSets.main.resources.srcDirs) {
|
from (sourceSets.main.resources.srcDirs) {
|
||||||
expand 'version': project.version,
|
expand 'version': project.version,
|
||||||
'mcVersion': project.minecraft.version,
|
'mcVersion': project.minecraft.version,
|
||||||
'forgeVersion': project.minecraft.forgeVersion,
|
'forgeVersion': project.forgeVersion,
|
||||||
'internalVersion': project.internalVersion
|
'internalVersion': project.internalVersion
|
||||||
include 'mcmod.info'
|
include 'mcmod.info'
|
||||||
}
|
}
|
||||||
@ -53,7 +58,8 @@ processResources {
|
|||||||
jar {
|
jar {
|
||||||
manifest {
|
manifest {
|
||||||
attributes("Class-Path": "truezip.jar WorldEdit/truezip.jar js.jar WorldEdit/js.jar",
|
attributes("Class-Path": "truezip.jar WorldEdit/truezip.jar js.jar WorldEdit/js.jar",
|
||||||
"WorldEdit-Version": version)
|
"WorldEdit-Version": version,
|
||||||
|
"FMLAT": "worldedit_at.cfg")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,8 +69,10 @@ shadowJar {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reobf.reobf(shadowJar) { spec ->
|
reobf {
|
||||||
spec.classpath = sourceSets.main.compileClasspath;
|
shadowJar {
|
||||||
|
mappingType = 'SEARGE'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task deobfJar(type: Jar) {
|
task deobfJar(type: Jar) {
|
||||||
@ -75,5 +83,3 @@ task deobfJar(type: Jar) {
|
|||||||
artifacts {
|
artifacts {
|
||||||
archives deobfJar
|
archives deobfJar
|
||||||
}
|
}
|
||||||
|
|
||||||
build.dependsOn(shadowJar)
|
|
||||||
|
@ -19,14 +19,14 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.forge;
|
package com.sk89q.worldedit.forge;
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
|
||||||
public class ClientProxy extends CommonProxy {
|
public class ClientProxy extends CommonProxy {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerHandlers() {
|
public void registerHandlers() {
|
||||||
super.registerHandlers();
|
super.registerHandlers();
|
||||||
FMLCommonHandler.instance().bus().register(new KeyHandler());
|
MinecraftForge.EVENT_BUS.register(new KeyHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,18 +19,14 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.forge;
|
package com.sk89q.worldedit.forge;
|
||||||
|
|
||||||
import com.google.common.base.Joiner;
|
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
|
||||||
import com.sk89q.worldedit.event.platform.CommandSuggestionEvent;
|
|
||||||
import com.sk89q.worldedit.util.command.CommandMapping;
|
import com.sk89q.worldedit.util.command.CommandMapping;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import net.minecraft.command.CommandBase;
|
import net.minecraft.command.CommandBase;
|
||||||
import net.minecraft.command.ICommand;
|
import net.minecraft.command.ICommand;
|
||||||
import net.minecraft.command.ICommandSender;
|
import net.minecraft.command.ICommandSender;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class CommandWrapper extends CommandBase {
|
public class CommandWrapper extends CommandBase {
|
||||||
private CommandMapping command;
|
private CommandMapping command;
|
||||||
@ -52,17 +48,6 @@ public class CommandWrapper extends CommandBase {
|
|||||||
@Override
|
@Override
|
||||||
public void processCommand(ICommandSender var1, String[] var2) {}
|
public void processCommand(ICommandSender var1, String[] var2) {}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List addTabCompletionOptions(ICommandSender sender, String[] arguments) {
|
|
||||||
if (sender instanceof EntityPlayerMP) {
|
|
||||||
CommandSuggestionEvent event = new CommandSuggestionEvent(ForgeWorldEdit.inst.wrap((EntityPlayerMP) sender), command.getPrimaryAlias() + " " + Joiner.on(" ").join(arguments));
|
|
||||||
WorldEdit.getInstance().getEventBus().post(event);
|
|
||||||
return event.getSuggestions();
|
|
||||||
} else {
|
|
||||||
return super.addTabCompletionOptions(sender, arguments);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCommandUsage(ICommandSender icommandsender) {
|
public String getCommandUsage(ICommandSender icommandsender) {
|
||||||
return "/" + command.getPrimaryAlias() + " " + command.getDescription().getUsage();
|
return "/" + command.getPrimaryAlias() + " " + command.getDescription().getUsage();
|
||||||
@ -79,7 +64,7 @@ public class CommandWrapper extends CommandBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(@Nullable Object o) {
|
public int compareTo(@Nullable ICommand o) {
|
||||||
if (o == null) {
|
if (o == null) {
|
||||||
return 0;
|
return 0;
|
||||||
} else if (o instanceof ICommand) {
|
} else if (o instanceof ICommand) {
|
||||||
|
@ -19,8 +19,9 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.forge;
|
package com.sk89q.worldedit.forge;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||||
|
|
||||||
import com.sk89q.worldedit.forge.gui.GuiHandler;
|
import com.sk89q.worldedit.forge.gui.GuiHandler;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
|
||||||
|
|
||||||
public class CommonProxy {
|
public class CommonProxy {
|
||||||
|
|
||||||
|
@ -20,10 +20,9 @@
|
|||||||
package com.sk89q.worldedit.forge;
|
package com.sk89q.worldedit.forge;
|
||||||
|
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.util.Direction;
|
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
|
|
||||||
final class ForgeAdapter {
|
final class ForgeAdapter {
|
||||||
|
|
||||||
@ -38,15 +37,16 @@ final class ForgeAdapter {
|
|||||||
return new Vector(vector.xCoord, vector.yCoord, vector.zCoord);
|
return new Vector(vector.xCoord, vector.yCoord, vector.zCoord);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int adapt(Direction face) {
|
public static Vector adapt(BlockPos pos) {
|
||||||
switch (face) {
|
return new Vector(pos.getX(), pos.getY(), pos.getZ());
|
||||||
case NORTH: return ForgeDirection.NORTH.ordinal();
|
|
||||||
case SOUTH: return ForgeDirection.SOUTH.ordinal();
|
|
||||||
case WEST: return ForgeDirection.WEST.ordinal();
|
|
||||||
case EAST: return ForgeDirection.EAST.ordinal();
|
|
||||||
case UP: return ForgeDirection.UP.ordinal();
|
|
||||||
case DOWN: return ForgeDirection.DOWN.ordinal();
|
|
||||||
default: return ForgeDirection.UNKNOWN.ordinal();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Vec3 toVec3(Vector vector) {
|
||||||
|
return new Vec3(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static BlockPos toBlockPos(Vector vector) {
|
||||||
|
return new BlockPos(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ import net.minecraft.entity.item.EntityTNTPrimed;
|
|||||||
import net.minecraft.entity.item.EntityXPOrb;
|
import net.minecraft.entity.item.EntityXPOrb;
|
||||||
import net.minecraft.entity.monster.EntityGolem;
|
import net.minecraft.entity.monster.EntityGolem;
|
||||||
import net.minecraft.entity.passive.EntityAmbientCreature;
|
import net.minecraft.entity.passive.EntityAmbientCreature;
|
||||||
|
import net.minecraft.entity.passive.EntityAnimal;
|
||||||
import net.minecraft.entity.passive.EntityTameable;
|
import net.minecraft.entity.passive.EntityTameable;
|
||||||
import net.minecraft.entity.passive.IAnimals;
|
import net.minecraft.entity.passive.IAnimals;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@ -108,7 +109,7 @@ public class ForgeEntityType implements EntityType {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAnimal() {
|
public boolean isAnimal() {
|
||||||
return entity instanceof IAnimals;
|
return entity instanceof EntityAnimal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -133,7 +134,7 @@ public class ForgeEntityType implements EntityType {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTagged() {
|
public boolean isTagged() {
|
||||||
return entity instanceof EntityLiving && ((EntityLiving) entity).hasCustomNameTag();
|
return entity instanceof EntityLiving && ((EntityLiving) entity).hasCustomName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,53 +0,0 @@
|
|||||||
/*
|
|
||||||
* WorldEdit, a Minecraft world manipulation toolkit
|
|
||||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
|
||||||
* Copyright (C) WorldEdit team and contributors
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU Lesser General Public License as published by the
|
|
||||||
* Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
||||||
* for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.sk89q.worldedit.forge;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.blocks.BaseItem;
|
|
||||||
import com.sk89q.worldedit.world.registry.ItemRegistry;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
public class ForgeItemRegistry implements ItemRegistry {
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public BaseItem createFromId(String id) {
|
|
||||||
Item item = (Item) Item.itemRegistry.getObject(id);
|
|
||||||
if (item != null) {
|
|
||||||
return new BaseItem(Item.getIdFromItem(item), (short) item.getDamage(new ItemStack(item, 1)));
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public BaseItem createFromId(int id) {
|
|
||||||
Item item = (Item) Item.itemRegistry.getObjectById(id);
|
|
||||||
if (item != null) {
|
|
||||||
return new BaseItem(Item.getIdFromItem(item), (short) item.getDamage(new ItemStack(item, 1)));
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -19,10 +19,11 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.forge;
|
package com.sk89q.worldedit.forge;
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
|
||||||
import net.minecraft.command.ICommand;
|
import net.minecraft.command.ICommand;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.world.WorldSettings.GameType;
|
import net.minecraft.world.WorldSettings.GameType;
|
||||||
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||||
|
import org.spongepowered.api.entity.living.player.Player;
|
||||||
|
|
||||||
public interface ForgePermissionsProvider {
|
public interface ForgePermissionsProvider {
|
||||||
|
|
||||||
@ -42,11 +43,24 @@ public interface ForgePermissionsProvider {
|
|||||||
public boolean hasPermission(EntityPlayerMP player, String permission) {
|
public boolean hasPermission(EntityPlayerMP player, String permission) {
|
||||||
ForgeConfiguration configuration = platform.getConfiguration();
|
ForgeConfiguration configuration = platform.getConfiguration();
|
||||||
return configuration.cheatMode ||
|
return configuration.cheatMode ||
|
||||||
FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().func_152596_g(player.getGameProfile()) ||
|
FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().canSendCommands(player.getGameProfile()) ||
|
||||||
(configuration.creativeEnable && player.theItemInWorldManager.getGameType() == GameType.CREATIVE);
|
(configuration.creativeEnable && player.theItemInWorldManager.getGameType() == GameType.CREATIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerPermission(ICommand command, String permission) {}
|
public void registerPermission(ICommand command, String permission) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class SpongePermissionsProvider implements ForgePermissionsProvider {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasPermission(EntityPlayerMP player, String permission) {
|
||||||
|
return ((Player) player).hasPermission(permission);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerPermission(ICommand command, String permission) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ import com.sk89q.worldedit.extension.platform.Preference;
|
|||||||
import com.sk89q.worldedit.util.command.CommandMapping;
|
import com.sk89q.worldedit.util.command.CommandMapping;
|
||||||
import com.sk89q.worldedit.util.command.Dispatcher;
|
import com.sk89q.worldedit.util.command.Dispatcher;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.command.ServerCommandManager;
|
import net.minecraft.command.ServerCommandManager;
|
||||||
import net.minecraft.entity.EntityList;
|
import net.minecraft.entity.EntityList;
|
||||||
@ -38,8 +38,10 @@ import net.minecraft.server.MinecraftServer;
|
|||||||
import net.minecraft.server.management.ServerConfigurationManager;
|
import net.minecraft.server.management.ServerConfigurationManager;
|
||||||
import net.minecraft.world.WorldServer;
|
import net.minecraft.world.WorldServer;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -121,7 +123,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform {
|
|||||||
if (player instanceof ForgePlayer) {
|
if (player instanceof ForgePlayer) {
|
||||||
return player;
|
return player;
|
||||||
} else {
|
} else {
|
||||||
EntityPlayerMP entity = server.getConfigurationManager().func_152612_a(player.getName());
|
EntityPlayerMP entity = server.getConfigurationManager().getPlayerByUsername(player.getName());
|
||||||
return entity != null ? new ForgePlayer(this, entity) : null;
|
return entity != null ? new ForgePlayer(this, entity) : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -202,7 +204,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform {
|
|||||||
List<Actor> users = new ArrayList<Actor>();
|
List<Actor> users = new ArrayList<Actor>();
|
||||||
ServerConfigurationManager scm = server.getConfigurationManager();
|
ServerConfigurationManager scm = server.getConfigurationManager();
|
||||||
for (String name : scm.getAllUsernames()) {
|
for (String name : scm.getAllUsernames()) {
|
||||||
EntityPlayerMP entity = scm.func_152612_a(name);
|
EntityPlayerMP entity = scm.getPlayerByUsername(name);
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
users.add(new ForgePlayer(this, entity));
|
users.add(new ForgePlayer(this, entity));
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,11 @@ import com.sk89q.worldedit.util.Location;
|
|||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.network.play.server.S3FPacketCustomPayload;
|
import net.minecraft.network.play.server.S3FPacketCustomPayload;
|
||||||
import net.minecraft.util.ChatComponentText;
|
import net.minecraft.util.ChatComponentText;
|
||||||
|
import io.netty.buffer.Unpooled;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
@ -64,7 +67,7 @@ public class ForgePlayer extends AbstractPlayerActor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.player.getCommandSenderName();
|
return this.player.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -78,8 +81,8 @@ public class ForgePlayer extends AbstractPlayerActor {
|
|||||||
return new Location(
|
return new Location(
|
||||||
ForgeWorldEdit.inst.getWorld(this.player.worldObj),
|
ForgeWorldEdit.inst.getWorld(this.player.worldObj),
|
||||||
position,
|
position,
|
||||||
this.player.cameraYaw,
|
this.player.rotationYaw,
|
||||||
this.player.cameraPitch);
|
this.player.rotationPitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -114,7 +117,8 @@ public class ForgePlayer extends AbstractPlayerActor {
|
|||||||
if (params.length > 0) {
|
if (params.length > 0) {
|
||||||
send = send + "|" + StringUtil.joinString(params, "|");
|
send = send + "|" + StringUtil.joinString(params, "|");
|
||||||
}
|
}
|
||||||
S3FPacketCustomPayload packet = new S3FPacketCustomPayload(ForgeWorldEdit.CUI_PLUGIN_CHANNEL, send.getBytes(WECUIPacketHandler.UTF_8_CHARSET));
|
PacketBuffer buffer = new PacketBuffer(Unpooled.copiedBuffer(send.getBytes(WECUIPacketHandler.UTF_8_CHARSET)));
|
||||||
|
S3FPacketCustomPayload packet = new S3FPacketCustomPayload(ForgeWorldEdit.CUI_PLUGIN_CHANNEL, buffer);
|
||||||
this.player.playerNetServerHandler.sendPacket(packet);
|
this.player.playerNetServerHandler.sendPacket(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,28 +131,30 @@ public class ForgePlayer extends AbstractPlayerActor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void printDebug(String msg) {
|
public void printDebug(String msg) {
|
||||||
for (String part : msg.split("\n")) {
|
sendColorized(msg, EnumChatFormatting.GRAY);
|
||||||
this.player.addChatMessage(new ChatComponentText("\u00a77" + part));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void print(String msg) {
|
public void print(String msg) {
|
||||||
for (String part : msg.split("\n")) {
|
sendColorized(msg, EnumChatFormatting.LIGHT_PURPLE);
|
||||||
this.player.addChatMessage(new ChatComponentText("\u00a7d" + part));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void printError(String msg) {
|
public void printError(String msg) {
|
||||||
|
sendColorized(msg, EnumChatFormatting.RED);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendColorized(String msg, EnumChatFormatting formatting) {
|
||||||
for (String part : msg.split("\n")) {
|
for (String part : msg.split("\n")) {
|
||||||
this.player.addChatMessage(new ChatComponentText("\u00a7c" + part));
|
ChatComponentText component = new ChatComponentText(part);
|
||||||
|
component.getChatStyle().setColor(formatting);
|
||||||
|
this.player.addChatMessage(component);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPosition(Vector pos, float pitch, float yaw) {
|
public void setPosition(Vector pos, float pitch, float yaw) {
|
||||||
this.player.playerNetServerHandler.setPlayerLocation(pos.getX(), pos.getY(), pos.getZ(), pitch, yaw);
|
this.player.playerNetServerHandler.setPlayerLocation(pos.getX(), pos.getY(), pos.getZ(), yaw, pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -174,7 +180,7 @@ public class ForgePlayer extends AbstractPlayerActor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SessionKey getSessionKey() {
|
public SessionKey getSessionKey() {
|
||||||
return new SessionKeyImpl(player.getUniqueID(), player.getCommandSenderName());
|
return new SessionKeyImpl(player.getUniqueID(), player.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class SessionKeyImpl implements SessionKey {
|
private static class SessionKeyImpl implements SessionKey {
|
||||||
|
@ -26,31 +26,41 @@ import com.sk89q.worldedit.Vector;
|
|||||||
import com.sk89q.worldedit.Vector2D;
|
import com.sk89q.worldedit.Vector2D;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
import com.sk89q.worldedit.blocks.BaseItem;
|
|
||||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||||
import com.sk89q.worldedit.blocks.LazyBlock;
|
import com.sk89q.worldedit.blocks.LazyBlock;
|
||||||
import com.sk89q.worldedit.entity.BaseEntity;
|
import com.sk89q.worldedit.entity.BaseEntity;
|
||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
import com.sk89q.worldedit.internal.Constants;
|
import com.sk89q.worldedit.internal.Constants;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.util.Direction;
|
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
||||||
import com.sk89q.worldedit.world.AbstractWorld;
|
import com.sk89q.worldedit.world.AbstractWorld;
|
||||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||||
import com.sk89q.worldedit.world.registry.WorldData;
|
import com.sk89q.worldedit.world.registry.WorldData;
|
||||||
|
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockLeaves;
|
||||||
|
import net.minecraft.block.BlockOldLeaf;
|
||||||
|
import net.minecraft.block.BlockOldLog;
|
||||||
|
import net.minecraft.block.BlockPlanks;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.EntityList;
|
import net.minecraft.entity.EntityList;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.LongHashMap;
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.world.ChunkCoordIntPair;
|
import net.minecraft.world.ChunkCoordIntPair;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.WorldServer;
|
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraft.world.chunk.IChunkProvider;
|
import net.minecraft.world.chunk.IChunkProvider;
|
||||||
import net.minecraft.world.gen.ChunkProviderServer;
|
import net.minecraft.world.gen.ChunkProviderServer;
|
||||||
@ -68,16 +78,6 @@ import net.minecraft.world.gen.feature.WorldGenTaiga2;
|
|||||||
import net.minecraft.world.gen.feature.WorldGenTrees;
|
import net.minecraft.world.gen.feature.WorldGenTrees;
|
||||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.lang.ref.WeakReference;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -85,8 +85,14 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
*/
|
*/
|
||||||
public class ForgeWorld extends AbstractWorld {
|
public class ForgeWorld extends AbstractWorld {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(ForgeWorld.class.getCanonicalName());
|
|
||||||
private static final Random random = new Random();
|
private static final Random random = new Random();
|
||||||
|
private static final int UPDATE = 1, NOTIFY = 2, NOTIFY_CLIENT = 4;
|
||||||
|
private static final Logger logger = Logger.getLogger(ForgeWorld.class.getCanonicalName());
|
||||||
|
|
||||||
|
private static final IBlockState JUNGLE_LOG = Blocks.log.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.JUNGLE);
|
||||||
|
private static final IBlockState JUNGLE_LEAF = Blocks.leaves.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.JUNGLE).withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false));
|
||||||
|
private static final IBlockState JUNGLE_SHRUB = Blocks.leaves.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK).withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false));
|
||||||
|
|
||||||
private final WeakReference<World> worldRef;
|
private final WeakReference<World> worldRef;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -134,14 +140,6 @@ public class ForgeWorld extends AbstractWorld {
|
|||||||
return getWorld().getWorldInfo().getWorldName();
|
return getWorld().getWorldInfo().getWorldName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean useItem(Vector position, BaseItem item, Direction face) {
|
|
||||||
Item nativeItem = Item.getItemById(item.getType());
|
|
||||||
ItemStack stack = new ItemStack(nativeItem, 1, item.getData());
|
|
||||||
World world = getWorld();
|
|
||||||
return stack.tryPlaceItemIntoWorld(new WorldEditFakePlayer((WorldServer) world), world, position.getBlockX(), position.getBlockY(), position.getBlockZ(), ForgeAdapter.adapt(face), 0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(Vector position, BaseBlock block, boolean notifyAndLight) throws WorldEditException {
|
public boolean setBlock(Vector position, BaseBlock block, boolean notifyAndLight) throws WorldEditException {
|
||||||
checkNotNull(position);
|
checkNotNull(position);
|
||||||
@ -154,33 +152,29 @@ public class ForgeWorld extends AbstractWorld {
|
|||||||
|
|
||||||
// First set the block
|
// First set the block
|
||||||
Chunk chunk = world.getChunkFromChunkCoords(x >> 4, z >> 4);
|
Chunk chunk = world.getChunkFromChunkCoords(x >> 4, z >> 4);
|
||||||
int previousId = 0;
|
BlockPos pos = new BlockPos(x, y, z);
|
||||||
|
IBlockState old = chunk.getBlockState(pos);
|
||||||
if (notifyAndLight) {
|
IBlockState newState = Block.getBlockById(block.getId()).getStateFromMeta(block.getData());
|
||||||
previousId = Block.getIdFromBlock(chunk.getBlock(x & 15, y, z & 15));
|
IBlockState successState = chunk.setBlockState(pos, newState);
|
||||||
}
|
boolean successful = successState != null;
|
||||||
|
|
||||||
boolean successful = chunk.func_150807_a(x & 15, y, z & 15, Block.getBlockById(block.getId()), block.getData());
|
|
||||||
|
|
||||||
// Create the TileEntity
|
// Create the TileEntity
|
||||||
if (successful) {
|
if (successful) {
|
||||||
CompoundTag tag = block.getNbtData();
|
if (block.hasNbtData()) {
|
||||||
if (tag != null) {
|
// Kill the old TileEntity
|
||||||
NBTTagCompound nativeTag = NBTConverter.toNative(tag);
|
world.removeTileEntity(pos);
|
||||||
|
NBTTagCompound nativeTag = NBTConverter.toNative(block.getNbtData());
|
||||||
nativeTag.setString("id", block.getNbtId());
|
nativeTag.setString("id", block.getNbtId());
|
||||||
TileEntityUtils.setTileEntity(getWorld(), position, nativeTag);
|
TileEntityUtils.setTileEntity(world, position, nativeTag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notifyAndLight) {
|
if (notifyAndLight) {
|
||||||
world.func_147451_t(x, y, z);
|
if (!successful) {
|
||||||
world.markBlockForUpdate(x, y, z);
|
newState = old;
|
||||||
world.notifyBlockChange(x, y, z, Block.getBlockById(previousId));
|
|
||||||
|
|
||||||
Block mcBlock = Block.getBlockById(previousId);
|
|
||||||
if (mcBlock != null && mcBlock.hasComparatorInputOverride()) {
|
|
||||||
world.func_147453_f(x, y, z, Block.getBlockById(block.getId()));
|
|
||||||
}
|
}
|
||||||
|
world.checkLight(pos);
|
||||||
|
world.markAndNotifyBlock(pos, chunk, old, newState, UPDATE | NOTIFY);
|
||||||
}
|
}
|
||||||
|
|
||||||
return successful;
|
return successful;
|
||||||
@ -189,13 +183,13 @@ public class ForgeWorld extends AbstractWorld {
|
|||||||
@Override
|
@Override
|
||||||
public int getBlockLightLevel(Vector position) {
|
public int getBlockLightLevel(Vector position) {
|
||||||
checkNotNull(position);
|
checkNotNull(position);
|
||||||
return getWorld().getBlockLightValue(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
return getWorld().getLight(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean clearContainerBlockContents(Vector position) {
|
public boolean clearContainerBlockContents(Vector position) {
|
||||||
checkNotNull(position);
|
checkNotNull(position);
|
||||||
TileEntity tile = getWorld().getTileEntity(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
TileEntity tile = getWorld().getTileEntity(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()));
|
||||||
if ((tile instanceof IInventory)) {
|
if ((tile instanceof IInventory)) {
|
||||||
IInventory inv = (IInventory) tile;
|
IInventory inv = (IInventory) tile;
|
||||||
int size = inv.getSizeInventory();
|
int size = inv.getSizeInventory();
|
||||||
@ -210,7 +204,7 @@ public class ForgeWorld extends AbstractWorld {
|
|||||||
@Override
|
@Override
|
||||||
public BaseBiome getBiome(Vector2D position) {
|
public BaseBiome getBiome(Vector2D position) {
|
||||||
checkNotNull(position);
|
checkNotNull(position);
|
||||||
return new BaseBiome(getWorld().getBiomeGenForCoords(position.getBlockX(), position.getBlockZ()).biomeID);
|
return new BaseBiome(getWorld().getBiomeGenForCoords(new BlockPos(position.getBlockX(), 0, position.getBlockZ())).biomeID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -218,8 +212,8 @@ public class ForgeWorld extends AbstractWorld {
|
|||||||
checkNotNull(position);
|
checkNotNull(position);
|
||||||
checkNotNull(biome);
|
checkNotNull(biome);
|
||||||
|
|
||||||
Chunk chunk = getWorld().getChunkFromBlockCoords(position.getBlockX(), position.getBlockZ());
|
Chunk chunk = getWorld().getChunkFromBlockCoords(new BlockPos(position.getBlockX(), 0, position.getBlockZ()));
|
||||||
if ((chunk != null) && (chunk.isChunkLoaded)) {
|
if ((chunk != null) && (chunk.isLoaded())) {
|
||||||
chunk.getBiomeArray()[((position.getBlockZ() & 0xF) << 4 | position.getBlockX() & 0xF)] = (byte) biome.getId();
|
chunk.getBiomeArray()[((position.getBlockZ() & 0xF) << 4 | position.getBlockX() & 0xF)] = (byte) biome.getId();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -237,7 +231,7 @@ public class ForgeWorld extends AbstractWorld {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EntityItem entity = new EntityItem(getWorld(), position.getX(), position.getY(), position.getZ(), ForgeWorldEdit.toForgeItemStack(item));
|
EntityItem entity = new EntityItem(getWorld(), position.getX(), position.getY(), position.getZ(), ForgeWorldEdit.toForgeItemStack(item));
|
||||||
entity.delayBeforeCanPickup = 10;
|
entity.setPickupDelay(10);
|
||||||
getWorld().spawnEntityInWorld(entity);
|
getWorld().spawnEntityInWorld(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,38 +258,7 @@ public class ForgeWorld extends AbstractWorld {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ChunkProviderServer chunkServer = (ChunkProviderServer) provider;
|
ChunkProviderServer chunkServer = (ChunkProviderServer) provider;
|
||||||
Field u;
|
IChunkProvider chunkProvider = chunkServer.serverChunkGenerator;
|
||||||
try {
|
|
||||||
u = ChunkProviderServer.class.getDeclaredField("field_73248_b"); // chunksToUnload
|
|
||||||
} catch(NoSuchFieldException e) {
|
|
||||||
u = ChunkProviderServer.class.getDeclaredField("chunksToUnload");
|
|
||||||
}
|
|
||||||
u.setAccessible(true);
|
|
||||||
Set<?> unloadQueue = (Set<?>) u.get(chunkServer);
|
|
||||||
Field m;
|
|
||||||
try {
|
|
||||||
m = ChunkProviderServer.class.getDeclaredField("field_73244_f"); // loadedChunkHashMap
|
|
||||||
} catch(NoSuchFieldException e) {
|
|
||||||
m = ChunkProviderServer.class.getDeclaredField("loadedChunkHashMap");
|
|
||||||
}
|
|
||||||
m.setAccessible(true);
|
|
||||||
LongHashMap loadedMap = (LongHashMap) m.get(chunkServer);
|
|
||||||
Field lc;
|
|
||||||
try {
|
|
||||||
lc = ChunkProviderServer.class.getDeclaredField("field_73245_g"); // loadedChunkHashMap
|
|
||||||
} catch(NoSuchFieldException e) {
|
|
||||||
lc = ChunkProviderServer.class.getDeclaredField("loadedChunks");
|
|
||||||
}
|
|
||||||
lc.setAccessible(true);
|
|
||||||
@SuppressWarnings("unchecked") List<Chunk> loaded = (List<Chunk>) lc.get(chunkServer);
|
|
||||||
Field p;
|
|
||||||
try {
|
|
||||||
p = ChunkProviderServer.class.getDeclaredField("field_73246_d"); // currentChunkProvider
|
|
||||||
} catch(NoSuchFieldException e) {
|
|
||||||
p = ChunkProviderServer.class.getDeclaredField("currentChunkProvider");
|
|
||||||
}
|
|
||||||
p.setAccessible(true);
|
|
||||||
IChunkProvider chunkProvider = (IChunkProvider) p.get(chunkServer);
|
|
||||||
|
|
||||||
for (Vector2D coord : chunks) {
|
for (Vector2D coord : chunks) {
|
||||||
long pos = ChunkCoordIntPair.chunkXZ2Int(coord.getBlockX(), coord.getBlockZ());
|
long pos = ChunkCoordIntPair.chunkXZ2Int(coord.getBlockX(), coord.getBlockZ());
|
||||||
@ -304,11 +267,11 @@ public class ForgeWorld extends AbstractWorld {
|
|||||||
mcChunk = chunkServer.loadChunk(coord.getBlockX(), coord.getBlockZ());
|
mcChunk = chunkServer.loadChunk(coord.getBlockX(), coord.getBlockZ());
|
||||||
mcChunk.onChunkUnload();
|
mcChunk.onChunkUnload();
|
||||||
}
|
}
|
||||||
unloadQueue.remove(pos);
|
chunkServer.droppedChunksSet.remove(pos);
|
||||||
loadedMap.remove(pos);
|
chunkServer.id2ChunkMap.remove(pos);
|
||||||
mcChunk = chunkProvider.provideChunk(coord.getBlockX(), coord.getBlockZ());
|
mcChunk = chunkProvider.provideChunk(coord.getBlockX(), coord.getBlockZ());
|
||||||
loadedMap.add(pos, mcChunk);
|
chunkServer.id2ChunkMap.add(pos, mcChunk);
|
||||||
loaded.add(mcChunk);
|
chunkServer.loadedChunks.add(mcChunk);
|
||||||
if (mcChunk != null) {
|
if (mcChunk != null) {
|
||||||
mcChunk.onChunkLoad();
|
mcChunk.onChunkLoad();
|
||||||
mcChunk.populateChunk(chunkProvider, chunkProvider, coord.getBlockX(), coord.getBlockZ());
|
mcChunk.populateChunk(chunkProvider, chunkProvider, coord.getBlockX(), coord.getBlockZ());
|
||||||
@ -346,12 +309,12 @@ public class ForgeWorld extends AbstractWorld {
|
|||||||
case REDWOOD: return new WorldGenTaiga2(true);
|
case REDWOOD: return new WorldGenTaiga2(true);
|
||||||
case TALL_REDWOOD: return new WorldGenTaiga1();
|
case TALL_REDWOOD: return new WorldGenTaiga1();
|
||||||
case BIRCH: return new WorldGenForest(true, false);
|
case BIRCH: return new WorldGenForest(true, false);
|
||||||
case JUNGLE: return new WorldGenMegaJungle(true, 10, 20, 3, 3);
|
case JUNGLE: return new WorldGenMegaJungle(true, 10, 20, JUNGLE_LOG, JUNGLE_LEAF);
|
||||||
case SMALL_JUNGLE: return new WorldGenTrees(true, 4 + random.nextInt(7), 3, 3, false);
|
case SMALL_JUNGLE: return new WorldGenTrees(true, 4 + random.nextInt(7), JUNGLE_LOG, JUNGLE_LEAF, false);
|
||||||
case SHORT_JUNGLE: return new WorldGenTrees(true, 4 + random.nextInt(7), 3, 3, true);
|
case SHORT_JUNGLE: return new WorldGenTrees(true, 4 + random.nextInt(7), JUNGLE_LOG, JUNGLE_LEAF, true);
|
||||||
case JUNGLE_BUSH: return new WorldGenShrub(3, 0);
|
case JUNGLE_BUSH: return new WorldGenShrub(JUNGLE_LOG, JUNGLE_SHRUB);
|
||||||
case RED_MUSHROOM: return new WorldGenBigMushroom(1);
|
case RED_MUSHROOM: return new WorldGenBigMushroom(Blocks.brown_mushroom_block);
|
||||||
case BROWN_MUSHROOM: return new WorldGenBigMushroom(0);
|
case BROWN_MUSHROOM: return new WorldGenBigMushroom(Blocks.red_mushroom_block);
|
||||||
case SWAMP: return new WorldGenSwamp();
|
case SWAMP: return new WorldGenSwamp();
|
||||||
case ACACIA: return new WorldGenSavannaTree(true);
|
case ACACIA: return new WorldGenSavannaTree(true);
|
||||||
case DARK_OAK: return new WorldGenCanopyTree(true);
|
case DARK_OAK: return new WorldGenCanopyTree(true);
|
||||||
@ -368,7 +331,7 @@ public class ForgeWorld extends AbstractWorld {
|
|||||||
@Override
|
@Override
|
||||||
public boolean generateTree(TreeType type, EditSession editSession, Vector position) throws MaxChangedBlocksException {
|
public boolean generateTree(TreeType type, EditSession editSession, Vector position) throws MaxChangedBlocksException {
|
||||||
WorldGenerator generator = createWorldGenerator(type);
|
WorldGenerator generator = createWorldGenerator(type);
|
||||||
return generator != null ? generator.generate(getWorld(), random, position.getBlockX(), position.getBlockY(), position.getBlockZ()) : false;
|
return generator != null ? generator.generate(getWorld(), random, ForgeAdapter.toBlockPos(position)) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -384,23 +347,23 @@ public class ForgeWorld extends AbstractWorld {
|
|||||||
@Override
|
@Override
|
||||||
public BaseBlock getBlock(Vector position) {
|
public BaseBlock getBlock(Vector position) {
|
||||||
World world = getWorld();
|
World world = getWorld();
|
||||||
int id = Block.getIdFromBlock(world.getBlock(position.getBlockX(), position.getBlockY(), position.getBlockZ()));
|
BlockPos pos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
||||||
int data = world.getBlockMetadata(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
IBlockState state = world.getBlockState(pos);
|
||||||
TileEntity tile = getWorld().getTileEntity(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
TileEntity tile = getWorld().getTileEntity(pos);
|
||||||
|
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
return new TileEntityBaseBlock(id, data, tile);
|
return new TileEntityBaseBlock(Block.getIdFromBlock(state.getBlock()), state.getBlock().getMetaFromState(state), tile);
|
||||||
} else {
|
} else {
|
||||||
return new BaseBlock(id, data);
|
return new BaseBlock(Block.getIdFromBlock(state.getBlock()), state.getBlock().getMetaFromState(state));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseBlock getLazyBlock(Vector position) {
|
public BaseBlock getLazyBlock(Vector position) {
|
||||||
World world = getWorld();
|
World world = getWorld();
|
||||||
int id = Block.getIdFromBlock(world.getBlock(position.getBlockX(), position.getBlockY(), position.getBlockZ()));
|
BlockPos pos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
||||||
int data = world.getBlockMetadata(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
IBlockState state = world.getBlockState(pos);
|
||||||
return new LazyBlock(id, data, this, position);
|
return new LazyBlock(Block.getIdFromBlock(state.getBlock()), state.getBlock().getMetaFromState(state), this, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -425,7 +388,6 @@ public class ForgeWorld extends AbstractWorld {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public List<? extends Entity> getEntities(Region region) {
|
public List<? extends Entity> getEntities(Region region) {
|
||||||
List<Entity> entities = new ArrayList<Entity>();
|
List<Entity> entities = new ArrayList<Entity>();
|
||||||
World world = getWorld();
|
World world = getWorld();
|
||||||
@ -441,8 +403,8 @@ public class ForgeWorld extends AbstractWorld {
|
|||||||
@Override
|
@Override
|
||||||
public List<? extends Entity> getEntities() {
|
public List<? extends Entity> getEntities() {
|
||||||
List<Entity> entities = new ArrayList<Entity>();
|
List<Entity> entities = new ArrayList<Entity>();
|
||||||
for (Object entity : getWorld().loadedEntityList) {
|
for (net.minecraft.entity.Entity entity : getWorld().loadedEntityList) {
|
||||||
entities.add(new ForgeEntity((net.minecraft.entity.Entity) entity));
|
entities.add(new ForgeEntity(entity));
|
||||||
}
|
}
|
||||||
return entities;
|
return entities;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
package com.sk89q.worldedit.forge;
|
package com.sk89q.worldedit.forge;
|
||||||
|
|
||||||
import com.sk89q.worldedit.world.registry.BiomeRegistry;
|
import com.sk89q.worldedit.world.registry.BiomeRegistry;
|
||||||
import com.sk89q.worldedit.world.registry.ItemRegistry;
|
|
||||||
import com.sk89q.worldedit.world.registry.LegacyWorldData;
|
import com.sk89q.worldedit.world.registry.LegacyWorldData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -29,14 +28,8 @@ import com.sk89q.worldedit.world.registry.LegacyWorldData;
|
|||||||
class ForgeWorldData extends LegacyWorldData {
|
class ForgeWorldData extends LegacyWorldData {
|
||||||
|
|
||||||
private static final ForgeWorldData INSTANCE = new ForgeWorldData();
|
private static final ForgeWorldData INSTANCE = new ForgeWorldData();
|
||||||
private final ItemRegistry itemRegistry = new ForgeItemRegistry();
|
|
||||||
private final BiomeRegistry biomeRegistry = new ForgeBiomeRegistry();
|
private final BiomeRegistry biomeRegistry = new ForgeBiomeRegistry();
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemRegistry getItemRegistry() {
|
|
||||||
return itemRegistry;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BiomeRegistry getBiomeRegistry() {
|
public BiomeRegistry getBiomeRegistry() {
|
||||||
return biomeRegistry;
|
return biomeRegistry;
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.forge;
|
package com.sk89q.worldedit.forge;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
@ -26,24 +28,10 @@ import com.sk89q.worldedit.WorldVector;
|
|||||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||||
import com.sk89q.worldedit.event.platform.PlatformReadyEvent;
|
import com.sk89q.worldedit.event.platform.PlatformReadyEvent;
|
||||||
import com.sk89q.worldedit.extension.platform.Platform;
|
import com.sk89q.worldedit.extension.platform.Platform;
|
||||||
import com.sk89q.worldedit.forge.compat.ForgeMultipartCompat;
|
|
||||||
import com.sk89q.worldedit.forge.compat.ForgeMultipartExistsCompat;
|
|
||||||
import com.sk89q.worldedit.forge.compat.NoForgeMultipartCompat;
|
|
||||||
import com.sk89q.worldedit.internal.LocalWorldAdapter;
|
import com.sk89q.worldedit.internal.LocalWorldAdapter;
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
|
||||||
import cpw.mods.fml.common.Loader;
|
import java.io.File;
|
||||||
import cpw.mods.fml.common.Mod;
|
import java.util.Map;
|
||||||
import cpw.mods.fml.common.Mod.EventHandler;
|
|
||||||
import cpw.mods.fml.common.Mod.Instance;
|
|
||||||
import cpw.mods.fml.common.SidedProxy;
|
|
||||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
|
||||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
|
||||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
|
||||||
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent;
|
|
||||||
import cpw.mods.fml.common.event.FMLServerStartedEvent;
|
|
||||||
import cpw.mods.fml.common.event.FMLServerStoppingEvent;
|
|
||||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@ -51,13 +39,22 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.CommandEvent;
|
import net.minecraftforge.event.CommandEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||||
import org.apache.logging.log4j.Logger;
|
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
||||||
|
import net.minecraftforge.fml.common.Loader;
|
||||||
import java.io.File;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import java.util.Map;
|
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;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
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 static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Forge implementation of WorldEdit.
|
* The Forge implementation of WorldEdit.
|
||||||
@ -80,7 +77,6 @@ public class ForgeWorldEdit {
|
|||||||
private ForgePlatform platform;
|
private ForgePlatform platform;
|
||||||
private ForgeConfiguration config;
|
private ForgeConfiguration config;
|
||||||
private File workingDir;
|
private File workingDir;
|
||||||
private ForgeMultipartCompat compat = new NoForgeMultipartCompat();
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent event) {
|
public void preInit(FMLPreInitializationEvent event) {
|
||||||
@ -92,16 +88,13 @@ public class ForgeWorldEdit {
|
|||||||
config = new ForgeConfiguration(this);
|
config = new ForgeConfiguration(this);
|
||||||
config.load();
|
config.load();
|
||||||
|
|
||||||
if (Loader.isModLoaded("ForgeMultipart")) {
|
MinecraftForge.EVENT_BUS.register(ThreadSafeCache.getInstance());
|
||||||
compat = new ForgeMultipartExistsCompat();
|
|
||||||
}
|
|
||||||
|
|
||||||
FMLCommonHandler.instance().bus().register(ThreadSafeCache.getInstance());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void init(FMLInitializationEvent event) {
|
public void init(FMLInitializationEvent event) {
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
WECUIPacketHandler.init();
|
||||||
proxy.registerHandlers();
|
proxy.registerHandlers();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,8 +115,13 @@ public class ForgeWorldEdit {
|
|||||||
this.platform = new ForgePlatform(this);
|
this.platform = new ForgePlatform(this);
|
||||||
|
|
||||||
WorldEdit.getInstance().getPlatformManager().register(platform);
|
WorldEdit.getInstance().getPlatformManager().register(platform);
|
||||||
|
|
||||||
|
if (Loader.isModLoaded("sponge")) {
|
||||||
|
this.provider = new ForgePermissionsProvider.SpongePermissionsProvider();
|
||||||
|
} else {
|
||||||
this.provider = new ForgePermissionsProvider.VanillaPermissionsProvider(platform);
|
this.provider = new ForgePermissionsProvider.VanillaPermissionsProvider(platform);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void serverStopping(FMLServerStoppingEvent event) {
|
public void serverStopping(FMLServerStoppingEvent event) {
|
||||||
@ -165,7 +163,7 @@ public class ForgeWorldEdit {
|
|||||||
Action action = event.action;
|
Action action = event.action;
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case LEFT_CLICK_BLOCK: {
|
case LEFT_CLICK_BLOCK: {
|
||||||
WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), event.x, event.y, event.z);
|
WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), event.pos.getX(), event.pos.getY(), event.pos.getZ());
|
||||||
|
|
||||||
if (we.handleBlockLeftClick(player, pos)) {
|
if (we.handleBlockLeftClick(player, pos)) {
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
@ -178,7 +176,7 @@ public class ForgeWorldEdit {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case RIGHT_CLICK_BLOCK: {
|
case RIGHT_CLICK_BLOCK: {
|
||||||
WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), event.x, event.y, event.z);
|
WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), event.pos.getX(), event.pos.getY(), event.pos.getZ());
|
||||||
|
|
||||||
if (we.handleBlockRightClick(player, pos)) {
|
if (we.handleBlockRightClick(player, pos)) {
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
@ -203,7 +201,7 @@ public class ForgeWorldEdit {
|
|||||||
public static ItemStack toForgeItemStack(BaseItemStack item) {
|
public static ItemStack toForgeItemStack(BaseItemStack item) {
|
||||||
ItemStack ret = new ItemStack(Item.getItemById(item.getType()), item.getAmount(), item.getData());
|
ItemStack ret = new ItemStack(Item.getItemById(item.getType()), item.getAmount(), item.getData());
|
||||||
for (Map.Entry<Integer, Integer> entry : item.getEnchantments().entrySet()) {
|
for (Map.Entry<Integer, Integer> entry : item.getEnchantments().entrySet()) {
|
||||||
ret.addEnchantment(net.minecraft.enchantment.Enchantment.enchantmentsList[((Integer) entry.getKey())], (Integer) entry.getValue());
|
ret.addEnchantment(net.minecraft.enchantment.Enchantment.getEnchantmentById(entry.getKey()), entry.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -269,10 +267,6 @@ public class ForgeWorldEdit {
|
|||||||
return this.workingDir;
|
return this.workingDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ForgeMultipartCompat getFMPCompat() {
|
|
||||||
return compat;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the version of the WorldEdit-for-Forge implementation.
|
* Get the version of the WorldEdit-for-Forge implementation.
|
||||||
*
|
*
|
||||||
|
@ -20,11 +20,13 @@
|
|||||||
package com.sk89q.worldedit.forge;
|
package com.sk89q.worldedit.forge;
|
||||||
|
|
||||||
import com.sk89q.worldedit.forge.gui.GuiHandler;
|
import com.sk89q.worldedit.forge.gui.GuiHandler;
|
||||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
|
||||||
import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.settings.KeyBinding;
|
import net.minecraft.client.settings.KeyBinding;
|
||||||
|
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;
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
public class KeyHandler {
|
public class KeyHandler {
|
||||||
|
@ -170,7 +170,7 @@ final class NBTConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static IntArrayTag fromNative(NBTTagIntArray other) {
|
public static IntArrayTag fromNative(NBTTagIntArray other) {
|
||||||
int[] value = other.func_150302_c();
|
int[] value = other.getIntArray();
|
||||||
return new IntArrayTag(Arrays.copyOf(value, value.length));
|
return new IntArrayTag(Arrays.copyOf(value, value.length));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,28 +192,28 @@ final class NBTConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static LongTag fromNative(NBTTagLong other) {
|
public static LongTag fromNative(NBTTagLong other) {
|
||||||
return new LongTag(other.func_150291_c());
|
return new LongTag(other.getLong());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static StringTag fromNative(NBTTagString other) {
|
public static StringTag fromNative(NBTTagString other) {
|
||||||
return new StringTag(other.func_150285_a_());
|
return new StringTag(other.getString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IntTag fromNative(NBTTagInt other) {
|
public static IntTag fromNative(NBTTagInt other) {
|
||||||
return new IntTag(other.func_150287_d());
|
return new IntTag(other.getInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ByteTag fromNative(NBTTagByte other) {
|
public static ByteTag fromNative(NBTTagByte other) {
|
||||||
return new ByteTag(other.func_150290_f());
|
return new ByteTag(other.getByte());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ByteArrayTag fromNative(NBTTagByteArray other) {
|
public static ByteArrayTag fromNative(NBTTagByteArray other) {
|
||||||
byte[] value = other.func_150292_c();
|
byte[] value = other.getByteArray();
|
||||||
return new ByteArrayTag(Arrays.copyOf(value, value.length));
|
return new ByteArrayTag(Arrays.copyOf(value, value.length));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CompoundTag fromNative(NBTTagCompound other) {
|
public static CompoundTag fromNative(NBTTagCompound other) {
|
||||||
@SuppressWarnings("unchecked") Collection<String> tags = other.func_150296_c();
|
@SuppressWarnings("unchecked") Set<String> tags = other.getKeySet();
|
||||||
Map<String, Tag> map = new HashMap<String, Tag>();
|
Map<String, Tag> map = new HashMap<String, Tag>();
|
||||||
for (String tagName : tags) {
|
for (String tagName : tags) {
|
||||||
map.put(tagName, fromNative(other.getTag(tagName)));
|
map.put(tagName, fromNative(other.getTag(tagName)));
|
||||||
@ -222,15 +222,15 @@ final class NBTConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static FloatTag fromNative(NBTTagFloat other) {
|
public static FloatTag fromNative(NBTTagFloat other) {
|
||||||
return new FloatTag(other.func_150288_h());
|
return new FloatTag(other.getFloat());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ShortTag fromNative(NBTTagShort other) {
|
public static ShortTag fromNative(NBTTagShort other) {
|
||||||
return new ShortTag(other.func_150289_e());
|
return new ShortTag(other.getShort());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DoubleTag fromNative(NBTTagDouble other) {
|
public static DoubleTag fromNative(NBTTagDouble other) {
|
||||||
return new DoubleTag(other.func_150286_g());
|
return new DoubleTag(other.getDouble());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,11 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.forge;
|
package com.sk89q.worldedit.forge;
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
|
||||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
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.fml.common.gameevent.TickEvent;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -56,7 +57,8 @@ public class ThreadSafeCache {
|
|||||||
if (now - lastRefresh > REFRESH_DELAY) {
|
if (now - lastRefresh > REFRESH_DELAY) {
|
||||||
Set<UUID> onlineIds = new HashSet<UUID>();
|
Set<UUID> onlineIds = new HashSet<UUID>();
|
||||||
|
|
||||||
if (FMLCommonHandler.instance().getMinecraftServerInstance() == null) {
|
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
|
||||||
|
if (server == null || server.getConfigurationManager() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (Object object : FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList) {
|
for (Object object : FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList) {
|
||||||
|
@ -20,12 +20,15 @@
|
|||||||
package com.sk89q.worldedit.forge;
|
package com.sk89q.worldedit.forge;
|
||||||
|
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagInt;
|
import net.minecraft.nbt.NBTTagInt;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
@ -81,10 +84,9 @@ final class TileEntityUtils {
|
|||||||
tileEntity.readFromNBT(tag);
|
tileEntity.readFromNBT(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
tileEntity = ForgeWorldEdit.inst.getFMPCompat().overrideTileEntity(world, tag, tileEntity);
|
world.setTileEntity(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()), tileEntity);
|
||||||
|
|
||||||
setTileEntity(world, position, tileEntity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a tile entity at the given location using the tile entity ID from
|
* Set a tile entity at the given location using the tile entity ID from
|
||||||
* the tag.
|
* the tag.
|
||||||
@ -96,27 +98,13 @@ final class TileEntityUtils {
|
|||||||
static void setTileEntity(World world, Vector position, @Nullable NBTTagCompound tag) {
|
static void setTileEntity(World world, Vector position, @Nullable NBTTagCompound tag) {
|
||||||
if (tag != null) {
|
if (tag != null) {
|
||||||
updateForSet(tag, position);
|
updateForSet(tag, position);
|
||||||
TileEntity tileEntity = makeTileEntity(world, position, tag);
|
TileEntity tileEntity = TileEntity.createAndLoadEntity(tag);
|
||||||
if (tileEntity != null) {
|
if (tileEntity != null) {
|
||||||
setTileEntity(world, position, tileEntity);
|
world.setTileEntity(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()), tileEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TileEntity makeTileEntity(World world, Vector position,
|
|
||||||
NBTTagCompound tag) {
|
|
||||||
TileEntity normal = TileEntity.createAndLoadEntity(tag);
|
|
||||||
return ForgeWorldEdit.inst.getFMPCompat().overrideTileEntity(world, tag,
|
|
||||||
normal);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void setTileEntity(World world, Vector position,
|
|
||||||
TileEntity tileEntity) {
|
|
||||||
world.setTileEntity(position.getBlockX(), position.getBlockY(),
|
|
||||||
position.getBlockZ(), tileEntity);
|
|
||||||
ForgeWorldEdit.inst.getFMPCompat().sendDescPacket(world, tileEntity);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a tile entity from the given class.
|
* Construct a tile entity from the given class.
|
||||||
*
|
*
|
||||||
|
@ -19,22 +19,23 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.forge;
|
package com.sk89q.worldedit.forge;
|
||||||
|
|
||||||
import java.nio.charset.Charset;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.network.NetHandlerPlayServer;
|
|
||||||
import net.minecraft.network.play.client.C17PacketCustomPayload;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
|
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
import java.nio.charset.Charset;
|
||||||
import cpw.mods.fml.common.network.FMLEventChannel;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
|
import net.minecraft.network.NetHandlerPlayServer;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
import net.minecraft.network.PacketBuffer;
|
||||||
|
import net.minecraft.network.ThreadQuickExitException;
|
||||||
|
import net.minecraft.network.play.server.S3FPacketCustomPayload;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.common.network.FMLEventChannel;
|
||||||
|
import net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientCustomPacketEvent;
|
||||||
|
import net.minecraftforge.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
|
||||||
|
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||||
|
|
||||||
public class WECUIPacketHandler {
|
public class WECUIPacketHandler {
|
||||||
public static final Charset UTF_8_CHARSET = Charset.forName("UTF-8");
|
public static final Charset UTF_8_CHARSET = Charset.forName("UTF-8");
|
||||||
private static FMLEventChannel WECUI_CHANNEL;
|
public static FMLEventChannel WECUI_CHANNEL;
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
WECUI_CHANNEL = NetworkRegistry.INSTANCE.newEventDrivenChannel(ForgeWorldEdit.CUI_PLUGIN_CHANNEL);
|
WECUI_CHANNEL = NetworkRegistry.INSTANCE.newEventDrivenChannel(ForgeWorldEdit.CUI_PLUGIN_CHANNEL);
|
||||||
@ -43,7 +44,6 @@ public class WECUIPacketHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onPacketData(ServerCustomPacketEvent event) {
|
public void onPacketData(ServerCustomPacketEvent event) {
|
||||||
C17PacketCustomPayload rawPacket = (C17PacketCustomPayload) event.packet.toC17Packet();
|
|
||||||
if (event.packet.channel().equals(ForgeWorldEdit.CUI_PLUGIN_CHANNEL)) {
|
if (event.packet.channel().equals(ForgeWorldEdit.CUI_PLUGIN_CHANNEL)) {
|
||||||
EntityPlayerMP player = getPlayerFromEvent(event);
|
EntityPlayerMP player = getPlayerFromEvent(event);
|
||||||
LocalSession session = ForgeWorldEdit.inst.getSession((EntityPlayerMP) player);
|
LocalSession session = ForgeWorldEdit.inst.getSession((EntityPlayerMP) player);
|
||||||
@ -52,8 +52,17 @@ public class WECUIPacketHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String text = new String(rawPacket.func_149558_e(), UTF_8_CHARSET);
|
String text = event.packet.payload().toString(UTF_8_CHARSET);
|
||||||
session.handleCUIInitializationMessage(text);
|
session.handleCUIInitializationMessage(text);
|
||||||
|
session.describeCUI(ForgeWorldEdit.inst.wrap(player));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void callProcessPacket(ClientCustomPacketEvent event) {
|
||||||
|
try {
|
||||||
|
new S3FPacketCustomPayload(event.packet.channel(), new PacketBuffer(event.packet.payload())).processPacket(event.handler);
|
||||||
|
} catch (ThreadQuickExitException suppress) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
* WorldEdit, a Minecraft world manipulation toolkit
|
|
||||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
|
||||||
* Copyright (C) WorldEdit team and contributors
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU Lesser General Public License as published by the
|
|
||||||
* Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
||||||
* for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.sk89q.worldedit.forge.compat;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public interface ForgeMultipartCompat {
|
|
||||||
|
|
||||||
TileEntity overrideTileEntity(World world, @Nullable NBTTagCompound tag,
|
|
||||||
TileEntity normal);
|
|
||||||
|
|
||||||
void sendDescPacket(World world, TileEntity entity);
|
|
||||||
|
|
||||||
}
|
|
@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
* WorldEdit, a Minecraft world manipulation toolkit
|
|
||||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
|
||||||
* Copyright (C) WorldEdit team and contributors
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU Lesser General Public License as published by the
|
|
||||||
* Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
||||||
* for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package com.sk89q.worldedit.forge.compat;
|
|
||||||
|
|
||||||
import codechicken.multipart.MultipartHelper;
|
|
||||||
import codechicken.multipart.TileMultipart;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class ForgeMultipartExistsCompat implements ForgeMultipartCompat {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity overrideTileEntity(World world,
|
|
||||||
@Nullable NBTTagCompound tag, TileEntity normal) {
|
|
||||||
if (tag == null) {
|
|
||||||
return normal;
|
|
||||||
}
|
|
||||||
TileEntity tile = MultipartHelper.createTileFromNBT(world, tag);
|
|
||||||
if (tile == null) {
|
|
||||||
return normal;
|
|
||||||
}
|
|
||||||
return tile;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendDescPacket(World world, TileEntity entity) {
|
|
||||||
if (entity instanceof TileMultipart) {
|
|
||||||
TileMultipart multi = (TileMultipart) entity;
|
|
||||||
MultipartHelper.sendDescPacket(world, multi);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
/*
|
|
||||||
* WorldEdit, a Minecraft world manipulation toolkit
|
|
||||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
|
||||||
* Copyright (C) WorldEdit team and contributors
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU Lesser General Public License as published by the
|
|
||||||
* Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
||||||
* for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.sk89q.worldedit.forge.compat;
|
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class NoForgeMultipartCompat implements ForgeMultipartCompat {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity overrideTileEntity(World world, NBTTagCompound tag,
|
|
||||||
TileEntity normal) {
|
|
||||||
return normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendDescPacket(World world, TileEntity entity) {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -19,9 +19,9 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.forge.gui;
|
package com.sk89q.worldedit.forge.gui;
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.IGuiHandler;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.fml.common.network.IGuiHandler;
|
||||||
|
|
||||||
public class GuiHandler implements IGuiHandler {
|
public class GuiHandler implements IGuiHandler {
|
||||||
|
|
||||||
|
4
worldedit-forge/src/main/resources/META-INF/worldedit_at.cfg
Normale Datei
4
worldedit-forge/src/main/resources/META-INF/worldedit_at.cfg
Normale Datei
@ -0,0 +1,4 @@
|
|||||||
|
public net.minecraft.world.gen.ChunkProviderServer field_73248_b # droppedChunksSet
|
||||||
|
public net.minecraft.world.gen.ChunkProviderServer field_73244_f # id2ChunkMap
|
||||||
|
public net.minecraft.world.gen.ChunkProviderServer field_73245_g # loadedChunks
|
||||||
|
public net.minecraft.world.gen.ChunkProviderServer field_73246_d # serverChunkGenerator
|
@ -1,12 +1,12 @@
|
|||||||
[{
|
[{
|
||||||
"modid": "WorldEdit",
|
"modid": "worldedit",
|
||||||
"name": "WorldEdit",
|
"name": "WorldEdit",
|
||||||
"description": "WorldEdit is an easy-to-use in-game world editor for Minecraft, supporting both single player and multiplayer.",
|
"description": "WorldEdit is an easy-to-use in-game world editor for Minecraft, supporting both single player and multiplayer.",
|
||||||
"version": "${internalVersion}",
|
"version": "${internalVersion}",
|
||||||
"mcversion": "${mcVersion}",
|
"mcversion": "${mcVersion}",
|
||||||
"url": "http://wiki.sk89q.com/wiki/WorldEdit",
|
"url": "http://wiki.sk89q.com/wiki/WorldEdit",
|
||||||
"updateUrl": "",
|
"updateUrl": "",
|
||||||
"authors": [ "sk89q", "wizjany", "TomyLobo" ],
|
"authors": [ "sk89q", "wizjany", "TomyLobo", "kenzierocks" ],
|
||||||
"credits": "",
|
"credits": "",
|
||||||
"logoFile": "",
|
"logoFile": "",
|
||||||
"screenshots": [],
|
"screenshots": [],
|
||||||
@ -15,7 +15,7 @@
|
|||||||
],
|
],
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"Forge@[${forgeVersion},)",
|
"Forge@[${forgeVersion},)",
|
||||||
"ForgeMultipart"
|
"sponge"
|
||||||
],
|
],
|
||||||
"dependants": []
|
"dependants": []
|
||||||
}]
|
}]
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren