mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
Switch to Forge 1.9 (12.16.0.1770)
This commit is contained in:
parent
5b38f460d4
commit
ecc4948668
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
|||||||
#Mon Feb 22 17:40:44 PST 2016
|
#Thu May 05 15:11:12 PDT 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=https\://services.gradle.org/distributions/gradle-2.11-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-bin.zip
|
||||||
|
46
gradlew
vendored
46
gradlew
vendored
@ -6,12 +6,30 @@
|
|||||||
##
|
##
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Attempt to set APP_HOME
|
||||||
DEFAULT_JVM_OPTS=""
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
APP_NAME="Gradle"
|
||||||
APP_BASE_NAME=`basename "$0"`
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD="maximum"
|
||||||
|
|
||||||
@ -30,6 +48,7 @@ die ( ) {
|
|||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
case "`uname`" in
|
case "`uname`" in
|
||||||
CYGWIN* )
|
CYGWIN* )
|
||||||
cygwin=true
|
cygwin=true
|
||||||
@ -40,26 +59,11 @@ case "`uname`" in
|
|||||||
MINGW* )
|
MINGW* )
|
||||||
msys=true
|
msys=true
|
||||||
;;
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
|
||||||
# Resolve links: $0 may be a link
|
|
||||||
PRG="$0"
|
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
|
||||||
ls=`ls -ld "$PRG"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
PRG="$link"
|
|
||||||
else
|
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
@ -85,7 +89,7 @@ location of your Java installation."
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
if [ $? -eq 0 ] ; then
|
if [ $? -eq 0 ] ; then
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
6
gradlew.bat
vendored
6
gradlew.bat
vendored
@ -8,14 +8,14 @@
|
|||||||
@rem Set local scope for the variables with windows NT shell
|
@rem Set local scope for the variables with windows NT shell
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
set DEFAULT_JVM_OPTS=
|
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS=
|
||||||
|
|
||||||
@rem Find java.exe
|
@rem Find java.exe
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
@ -27,12 +27,12 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
version = "6.1.1"
|
version = "6.1.1"
|
||||||
ext.forgeVersion = "11.15.1.1760"
|
ext.forgeVersion = "12.16.1.1891"
|
||||||
ext.internalVersion = version + ";" + gitCommitHash
|
ext.internalVersion = version + ";" + gitCommitHash
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
version = "1.8.9-${project.forgeVersion}"
|
version = "1.9-${project.forgeVersion}"
|
||||||
mappings = "snapshot_20160111"
|
mappings = "snapshot_20160505"
|
||||||
runDir = 'run'
|
runDir = 'run'
|
||||||
|
|
||||||
replaceIn "com/sk89q/worldedit/forge/ForgeWorldEdit.java"
|
replaceIn "com/sk89q/worldedit/forge/ForgeWorldEdit.java"
|
||||||
|
@ -25,8 +25,10 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import net.minecraft.command.CommandBase;
|
import net.minecraft.command.CommandBase;
|
||||||
|
import net.minecraft.command.CommandException;
|
||||||
import net.minecraft.command.ICommand;
|
import net.minecraft.command.ICommand;
|
||||||
import net.minecraft.command.ICommandSender;
|
import net.minecraft.command.ICommandSender;
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
|
||||||
public class CommandWrapper extends CommandBase {
|
public class CommandWrapper extends CommandBase {
|
||||||
private CommandMapping command;
|
private CommandMapping command;
|
||||||
@ -46,7 +48,8 @@ public class CommandWrapper extends CommandBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processCommand(ICommandSender var1, String[] var2) {}
|
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCommandUsage(ICommandSender icommandsender) {
|
public String getCommandUsage(ICommandSender icommandsender) {
|
||||||
@ -59,7 +62,7 @@ public class CommandWrapper extends CommandBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canCommandSenderUseCommand(ICommandSender sender) {
|
public boolean checkPermission(MinecraftServer server, ICommandSender sender) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,9 @@ package com.sk89q.worldedit.forge;
|
|||||||
|
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
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.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
final class ForgeAdapter {
|
final class ForgeAdapter {
|
||||||
|
|
||||||
@ -33,7 +34,7 @@ final class ForgeAdapter {
|
|||||||
return new ForgeWorld(world);
|
return new ForgeWorld(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector adapt(Vec3 vector) {
|
public static Vector adapt(Vec3d vector) {
|
||||||
return new Vector(vector.xCoord, vector.yCoord, vector.zCoord);
|
return new Vector(vector.xCoord, vector.yCoord, vector.zCoord);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,8 +42,8 @@ final class ForgeAdapter {
|
|||||||
return new Vector(pos.getX(), pos.getY(), pos.getZ());
|
return new Vector(pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vec3 toVec3(Vector vector) {
|
public static Vec3d toVec3(Vector vector) {
|
||||||
return new Vec3(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ());
|
return new Vec3d(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockPos toBlockPos(Vector vector) {
|
public static BlockPos toBlockPos(Vector vector) {
|
||||||
|
@ -19,29 +19,20 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.forge;
|
package com.sk89q.worldedit.forge;
|
||||||
|
|
||||||
import com.google.common.collect.HashBiMap;
|
|
||||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeData;
|
import com.sk89q.worldedit.world.biome.BiomeData;
|
||||||
import com.sk89q.worldedit.world.registry.BiomeRegistry;
|
import com.sk89q.worldedit.world.registry.BiomeRegistry;
|
||||||
|
|
||||||
import net.minecraft.world.biome.BiomeGenBase;
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides access to biome data in Forge.
|
* Provides access to biome data in Forge.
|
||||||
*/
|
*/
|
||||||
class ForgeBiomeRegistry implements BiomeRegistry {
|
class ForgeBiomeRegistry implements BiomeRegistry {
|
||||||
private static Map<Integer, BiomeGenBase> biomes = Collections.emptyMap();
|
|
||||||
private static Map<Integer, BiomeData> biomeData = Collections.emptyMap();
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
@Override
|
||||||
public BaseBiome createFromId(int id) {
|
public BaseBiome createFromId(int id) {
|
||||||
return new BaseBiome(id);
|
return new BaseBiome(id);
|
||||||
@ -50,38 +41,15 @@ class ForgeBiomeRegistry implements BiomeRegistry {
|
|||||||
@Override
|
@Override
|
||||||
public List<BaseBiome> getBiomes() {
|
public List<BaseBiome> getBiomes() {
|
||||||
List<BaseBiome> list = new ArrayList<BaseBiome>();
|
List<BaseBiome> list = new ArrayList<BaseBiome>();
|
||||||
for (int biome : biomes.keySet()) {
|
for (BiomeGenBase biome : BiomeGenBase.REGISTRY) {
|
||||||
list.add(new BaseBiome(biome));
|
list.add(new BaseBiome(BiomeGenBase.getIdForBiome(biome)));
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
@Override
|
||||||
public BiomeData getData(BaseBiome biome) {
|
public BiomeData getData(BaseBiome biome) {
|
||||||
return biomeData.get(biome.getId());
|
return new ForgeBiomeData(BiomeGenBase.getBiome(biome.getId()));
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Populate the internal static list of biomes.
|
|
||||||
*
|
|
||||||
* <p>If called repeatedly, the last call will overwrite all previous
|
|
||||||
* calls.</p>
|
|
||||||
*/
|
|
||||||
static void populate() {
|
|
||||||
Map<Integer, BiomeGenBase> biomes = HashBiMap.create();
|
|
||||||
Map<Integer, BiomeData> biomeData = new HashMap<Integer, BiomeData>();
|
|
||||||
|
|
||||||
for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) {
|
|
||||||
if ((biome == null) || (biomes.containsValue(biome))) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
biomes.put(biome.biomeID, biome);
|
|
||||||
biomeData.put(biome.biomeID, new ForgeBiomeData(biome));
|
|
||||||
}
|
|
||||||
|
|
||||||
ForgeBiomeRegistry.biomes = biomes;
|
|
||||||
ForgeBiomeRegistry.biomeData = biomeData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -101,7 +69,7 @@ class ForgeBiomeRegistry implements BiomeRegistry {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return biome.biomeName;
|
return biome.getBiomeName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ import net.minecraft.entity.EntityLiving;
|
|||||||
import net.minecraft.entity.IMerchant;
|
import net.minecraft.entity.IMerchant;
|
||||||
import net.minecraft.entity.INpc;
|
import net.minecraft.entity.INpc;
|
||||||
import net.minecraft.entity.IProjectile;
|
import net.minecraft.entity.IProjectile;
|
||||||
|
import net.minecraft.entity.item.EntityArmorStand;
|
||||||
import net.minecraft.entity.item.EntityBoat;
|
import net.minecraft.entity.item.EntityBoat;
|
||||||
import net.minecraft.entity.item.EntityEnderEye;
|
import net.minecraft.entity.item.EntityEnderEye;
|
||||||
import net.minecraft.entity.item.EntityFallingBlock;
|
import net.minecraft.entity.item.EntityFallingBlock;
|
||||||
@ -38,7 +39,6 @@ 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.EntityAnimal;
|
||||||
import net.minecraft.entity.passive.EntityTameable;
|
import net.minecraft.entity.passive.EntityTameable;
|
||||||
import net.minecraft.entity.passive.IAnimals;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
@ -139,6 +139,6 @@ public class ForgeEntityType implements EntityType {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isArmorStand() {
|
public boolean isArmorStand() {
|
||||||
return false; // TODO re-add when forge version is updated to 1.8: entity instanceof EntityArmorStand;
|
return entity instanceof EntityArmorStand;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,8 +43,8 @@ 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().canSendCommands(player.getGameProfile()) ||
|
FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().canSendCommands(player.getGameProfile()) ||
|
||||||
(configuration.creativeEnable && player.theItemInWorldManager.getGameType() == GameType.CREATIVE);
|
(configuration.creativeEnable && player.interactionManager.getGameType() == GameType.CREATIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -35,7 +35,7 @@ import net.minecraft.entity.EntityList;
|
|||||||
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.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.management.ServerConfigurationManager;
|
import net.minecraft.server.management.PlayerList;
|
||||||
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 net.minecraftforge.fml.common.FMLCommonHandler;
|
||||||
@ -43,7 +43,6 @@ 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.Collection;
|
import java.util.Collection;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -77,8 +76,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Object itemObj : Item.itemRegistry) {
|
for (Item item : Item.REGISTRY) {
|
||||||
Item item = (Item) itemObj;
|
|
||||||
if (item == null) continue;
|
if (item == null) continue;
|
||||||
if (item.getUnlocalizedName() == null) continue;
|
if (item.getUnlocalizedName() == null) continue;
|
||||||
if (item.getUnlocalizedName().startsWith("item.")) {
|
if (item.getUnlocalizedName().startsWith("item.")) {
|
||||||
@ -94,7 +92,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValidMobType(String type) {
|
public boolean isValidMobType(String type) {
|
||||||
return EntityList.stringToClassMapping.containsKey(type);
|
return EntityList.NAME_TO_CLASS.containsKey(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -109,8 +107,8 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<? extends com.sk89q.worldedit.world.World> getWorlds() {
|
public List<? extends com.sk89q.worldedit.world.World> getWorlds() {
|
||||||
List<WorldServer> worlds = Arrays.asList(DimensionManager.getWorlds());
|
WorldServer[] worlds = DimensionManager.getWorlds();
|
||||||
List<com.sk89q.worldedit.world.World> ret = new ArrayList<com.sk89q.worldedit.world.World>(worlds.size());
|
List<com.sk89q.worldedit.world.World> ret = new ArrayList<com.sk89q.worldedit.world.World>(worlds.length);
|
||||||
for (WorldServer world : worlds) {
|
for (WorldServer world : worlds) {
|
||||||
ret.add(new ForgeWorld(world));
|
ret.add(new ForgeWorld(world));
|
||||||
}
|
}
|
||||||
@ -123,7 +121,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().getPlayerByUsername(player.getName());
|
EntityPlayerMP entity = server.getPlayerList().getPlayerByUsername(player.getName());
|
||||||
return entity != null ? new ForgePlayer(this, entity) : null;
|
return entity != null ? new ForgePlayer(this, entity) : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -202,9 +200,8 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform {
|
|||||||
@Override
|
@Override
|
||||||
public Collection<Actor> getConnectedUsers() {
|
public Collection<Actor> getConnectedUsers() {
|
||||||
List<Actor> users = new ArrayList<Actor>();
|
List<Actor> users = new ArrayList<Actor>();
|
||||||
ServerConfigurationManager scm = server.getConfigurationManager();
|
PlayerList scm = server.getPlayerList();
|
||||||
for (String name : scm.getAllUsernames()) {
|
for (EntityPlayerMP entity : scm.getPlayerList()) {
|
||||||
EntityPlayerMP entity = scm.getPlayerByUsername(name);
|
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
users.add(new ForgePlayer(this, entity));
|
users.add(new ForgePlayer(this, entity));
|
||||||
}
|
}
|
||||||
|
@ -30,18 +30,17 @@ import com.sk89q.worldedit.internal.cui.CUIEvent;
|
|||||||
import com.sk89q.worldedit.session.SessionKey;
|
import com.sk89q.worldedit.session.SessionKey;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
|
|
||||||
|
import io.netty.buffer.Unpooled;
|
||||||
|
import java.util.UUID;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
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.PacketBuffer;
|
||||||
import net.minecraft.network.play.server.S3FPacketCustomPayload;
|
import net.minecraft.network.play.server.SPacketCustomPayload;
|
||||||
import net.minecraft.util.ChatComponentText;
|
import net.minecraft.util.EnumHand;
|
||||||
import io.netty.buffer.Unpooled;
|
import net.minecraft.util.text.TextComponentString;
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class ForgePlayer extends AbstractPlayerActor {
|
public class ForgePlayer extends AbstractPlayerActor {
|
||||||
|
|
||||||
@ -61,7 +60,7 @@ public class ForgePlayer extends AbstractPlayerActor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemInHand() {
|
public int getItemInHand() {
|
||||||
ItemStack is = this.player.getCurrentEquippedItem();
|
ItemStack is = this.player.getHeldItem(EnumHand.MAIN_HAND);
|
||||||
return is == null ? 0 : Item.getIdFromItem(is.getItem());
|
return is == null ? 0 : Item.getIdFromItem(is.getItem());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,6 +84,7 @@ public class ForgePlayer extends AbstractPlayerActor {
|
|||||||
this.player.rotationPitch);
|
this.player.rotationPitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public WorldVector getPosition() {
|
public WorldVector getPosition() {
|
||||||
return new WorldVector(LocalWorldAdapter.adapt(ForgeWorldEdit.inst.getWorld(this.player.worldObj)), this.player.posX, this.player.posY, this.player.posZ);
|
return new WorldVector(LocalWorldAdapter.adapt(ForgeWorldEdit.inst.getWorld(this.player.worldObj)), this.player.posX, this.player.posY, this.player.posZ);
|
||||||
@ -118,36 +118,36 @@ public class ForgePlayer extends AbstractPlayerActor {
|
|||||||
send = send + "|" + StringUtil.joinString(params, "|");
|
send = send + "|" + StringUtil.joinString(params, "|");
|
||||||
}
|
}
|
||||||
PacketBuffer buffer = new PacketBuffer(Unpooled.copiedBuffer(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);
|
SPacketCustomPayload packet = new SPacketCustomPayload(ForgeWorldEdit.CUI_PLUGIN_CHANNEL, buffer);
|
||||||
this.player.playerNetServerHandler.sendPacket(packet);
|
this.player.playerNetServerHandler.sendPacket(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void printRaw(String msg) {
|
public void printRaw(String msg) {
|
||||||
for (String part : msg.split("\n")) {
|
for (String part : msg.split("\n")) {
|
||||||
this.player.addChatMessage(new ChatComponentText(part));
|
this.player.addChatMessage(new TextComponentString(part));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void printDebug(String msg) {
|
public void printDebug(String msg) {
|
||||||
sendColorized(msg, EnumChatFormatting.GRAY);
|
sendColorized(msg, TextFormatting.GRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void print(String msg) {
|
public void print(String msg) {
|
||||||
sendColorized(msg, EnumChatFormatting.LIGHT_PURPLE);
|
sendColorized(msg, TextFormatting.LIGHT_PURPLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void printError(String msg) {
|
public void printError(String msg) {
|
||||||
sendColorized(msg, EnumChatFormatting.RED);
|
sendColorized(msg, TextFormatting.RED);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendColorized(String msg, EnumChatFormatting formatting) {
|
private void sendColorized(String msg, TextFormatting formatting) {
|
||||||
for (String part : msg.split("\n")) {
|
for (String part : msg.split("\n")) {
|
||||||
ChatComponentText component = new ChatComponentText(part);
|
TextComponentString component = new TextComponentString(part);
|
||||||
component.getChatStyle().setColor(formatting);
|
component.getStyle().setColor(formatting);
|
||||||
this.player.addChatMessage(component);
|
this.player.addChatMessage(component);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,16 +58,17 @@ import net.minecraft.init.Blocks;
|
|||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.BlockPos;
|
import net.minecraft.util.math.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.biome.BiomeGenBase;
|
||||||
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;
|
||||||
import net.minecraft.world.gen.feature.WorldGenBigMushroom;
|
import net.minecraft.world.gen.feature.WorldGenBigMushroom;
|
||||||
import net.minecraft.world.gen.feature.WorldGenBigTree;
|
import net.minecraft.world.gen.feature.WorldGenBigTree;
|
||||||
|
import net.minecraft.world.gen.feature.WorldGenBirchTree;
|
||||||
import net.minecraft.world.gen.feature.WorldGenCanopyTree;
|
import net.minecraft.world.gen.feature.WorldGenCanopyTree;
|
||||||
import net.minecraft.world.gen.feature.WorldGenForest;
|
|
||||||
import net.minecraft.world.gen.feature.WorldGenMegaJungle;
|
import net.minecraft.world.gen.feature.WorldGenMegaJungle;
|
||||||
import net.minecraft.world.gen.feature.WorldGenMegaPineTree;
|
import net.minecraft.world.gen.feature.WorldGenMegaPineTree;
|
||||||
import net.minecraft.world.gen.feature.WorldGenSavannaTree;
|
import net.minecraft.world.gen.feature.WorldGenSavannaTree;
|
||||||
@ -89,9 +90,9 @@ public class ForgeWorld extends AbstractWorld {
|
|||||||
private static final int UPDATE = 1, NOTIFY = 2, NOTIFY_CLIENT = 4;
|
private static final int UPDATE = 1, NOTIFY = 2, NOTIFY_CLIENT = 4;
|
||||||
private static final Logger logger = Logger.getLogger(ForgeWorld.class.getCanonicalName());
|
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_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_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 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;
|
||||||
|
|
||||||
@ -204,7 +205,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(new BlockPos(position.getBlockX(), 0, position.getBlockZ())).biomeID);
|
return new BaseBiome(BiomeGenBase.getIdForBiome(getWorld().getBiomeGenForCoords(new BlockPos(position.getBlockX(), 0, position.getBlockZ()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -258,8 +259,6 @@ public class ForgeWorld extends AbstractWorld {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ChunkProviderServer chunkServer = (ChunkProviderServer) provider;
|
ChunkProviderServer chunkServer = (ChunkProviderServer) provider;
|
||||||
IChunkProvider chunkProvider = chunkServer.serverChunkGenerator;
|
|
||||||
|
|
||||||
for (Vector2D coord : chunks) {
|
for (Vector2D coord : chunks) {
|
||||||
long pos = ChunkCoordIntPair.chunkXZ2Int(coord.getBlockX(), coord.getBlockZ());
|
long pos = ChunkCoordIntPair.chunkXZ2Int(coord.getBlockX(), coord.getBlockZ());
|
||||||
Chunk mcChunk;
|
Chunk mcChunk;
|
||||||
@ -269,12 +268,12 @@ public class ForgeWorld extends AbstractWorld {
|
|||||||
}
|
}
|
||||||
chunkServer.droppedChunksSet.remove(pos);
|
chunkServer.droppedChunksSet.remove(pos);
|
||||||
chunkServer.id2ChunkMap.remove(pos);
|
chunkServer.id2ChunkMap.remove(pos);
|
||||||
mcChunk = chunkProvider.provideChunk(coord.getBlockX(), coord.getBlockZ());
|
mcChunk = chunkServer.provideChunk(coord.getBlockX(), coord.getBlockZ());
|
||||||
chunkServer.id2ChunkMap.add(pos, mcChunk);
|
chunkServer.id2ChunkMap.add(pos, mcChunk);
|
||||||
chunkServer.loadedChunks.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(chunkServer, chunkServer.chunkGenerator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
@ -308,18 +307,18 @@ public class ForgeWorld extends AbstractWorld {
|
|||||||
case BIG_TREE: return new WorldGenBigTree(true);
|
case BIG_TREE: return new WorldGenBigTree(true);
|
||||||
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 WorldGenBirchTree(true, false);
|
||||||
case JUNGLE: return new WorldGenMegaJungle(true, 10, 20, JUNGLE_LOG, JUNGLE_LEAF);
|
case JUNGLE: return new WorldGenMegaJungle(true, 10, 20, JUNGLE_LOG, JUNGLE_LEAF);
|
||||||
case SMALL_JUNGLE: return new WorldGenTrees(true, 4 + random.nextInt(7), JUNGLE_LOG, JUNGLE_LEAF, 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), JUNGLE_LOG, JUNGLE_LEAF, true);
|
case SHORT_JUNGLE: return new WorldGenTrees(true, 4 + random.nextInt(7), JUNGLE_LOG, JUNGLE_LEAF, true);
|
||||||
case JUNGLE_BUSH: return new WorldGenShrub(JUNGLE_LOG, JUNGLE_SHRUB);
|
case JUNGLE_BUSH: return new WorldGenShrub(JUNGLE_LOG, JUNGLE_SHRUB);
|
||||||
case RED_MUSHROOM: return new WorldGenBigMushroom(Blocks.brown_mushroom_block);
|
case RED_MUSHROOM: return new WorldGenBigMushroom(Blocks.BROWN_MUSHROOM_BLOCK);
|
||||||
case BROWN_MUSHROOM: return new WorldGenBigMushroom(Blocks.red_mushroom_block);
|
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);
|
||||||
case MEGA_REDWOOD: return new WorldGenMegaPineTree(false, random.nextBoolean());
|
case MEGA_REDWOOD: return new WorldGenMegaPineTree(false, random.nextBoolean());
|
||||||
case TALL_BIRCH: return new WorldGenForest(true, true);
|
case TALL_BIRCH: return new WorldGenBirchTree(true, true);
|
||||||
case RANDOM:
|
case RANDOM:
|
||||||
case PINE:
|
case PINE:
|
||||||
case RANDOM_REDWOOD:
|
case RANDOM_REDWOOD:
|
||||||
@ -390,9 +389,7 @@ public class ForgeWorld extends AbstractWorld {
|
|||||||
@Override
|
@Override
|
||||||
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();
|
for (net.minecraft.entity.Entity entity : getWorld().loadedEntityList) {
|
||||||
List<net.minecraft.entity.Entity> ents = world.loadedEntityList;
|
|
||||||
for (net.minecraft.entity.Entity entity : ents) {
|
|
||||||
if (region.contains(new Vector(entity.posX, entity.posY, entity.posZ))) {
|
if (region.contains(new Vector(entity.posX, entity.posY, entity.posZ))) {
|
||||||
entities.add(new ForgeEntity(entity));
|
entities.add(new ForgeEntity(entity));
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.forge;
|
package com.sk89q.worldedit.forge;
|
||||||
|
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
@ -39,7 +41,6 @@ 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 net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
|
||||||
import net.minecraftforge.fml.common.Loader;
|
import net.minecraftforge.fml.common.Loader;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||||
@ -110,8 +111,6 @@ public class ForgeWorldEdit {
|
|||||||
WorldEdit.getInstance().getPlatformManager().unregister(platform);
|
WorldEdit.getInstance().getPlatformManager().unregister(platform);
|
||||||
}
|
}
|
||||||
|
|
||||||
ForgeBiomeRegistry.populate();
|
|
||||||
|
|
||||||
this.platform = new ForgePlatform(this);
|
this.platform = new ForgePlatform(this);
|
||||||
|
|
||||||
WorldEdit.getInstance().getPlatformManager().register(platform);
|
WorldEdit.getInstance().getPlatformManager().register(platform);
|
||||||
@ -135,13 +134,13 @@ public class ForgeWorldEdit {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onCommandEvent(CommandEvent event) {
|
public void onCommandEvent(CommandEvent event) {
|
||||||
if ((event.sender instanceof EntityPlayerMP)) {
|
if ((event.getSender() instanceof EntityPlayerMP)) {
|
||||||
if (((EntityPlayerMP) event.sender).worldObj.isRemote) return;
|
if (((EntityPlayerMP) event.getSender()).worldObj.isRemote) return;
|
||||||
String[] split = new String[event.parameters.length + 1];
|
String[] split = new String[event.getParameters().length + 1];
|
||||||
System.arraycopy(event.parameters, 0, split, 1, event.parameters.length);
|
System.arraycopy(event.getParameters(), 0, split, 1, event.getParameters().length);
|
||||||
split[0] = event.command.getCommandName();
|
split[0] = event.getCommand().getCommandName();
|
||||||
com.sk89q.worldedit.event.platform.CommandEvent weEvent =
|
com.sk89q.worldedit.event.platform.CommandEvent weEvent =
|
||||||
new com.sk89q.worldedit.event.platform.CommandEvent(wrap((EntityPlayerMP) event.sender), Joiner.on(" ").join(split));
|
new com.sk89q.worldedit.event.platform.CommandEvent(wrap((EntityPlayerMP) event.getSender()), Joiner.on(" ").join(split));
|
||||||
WorldEdit.getInstance().getEventBus().post(weEvent);
|
WorldEdit.getInstance().getEventBus().post(weEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -152,48 +151,49 @@ public class ForgeWorldEdit {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!platform.isHookingEvents()) return; // We have to be told to catch these events
|
if (!platform.isHookingEvents())
|
||||||
|
return; // We have to be told to catch these events
|
||||||
|
|
||||||
if (event.useItem == Result.DENY || event.entity.worldObj.isRemote) return;
|
if ((event instanceof PlayerInteractEvent.LeftClickBlock
|
||||||
|
&& ((PlayerInteractEvent.LeftClickBlock) event)
|
||||||
|
.getUseItem() == Result.DENY)
|
||||||
|
|| (event instanceof PlayerInteractEvent.RightClickBlock
|
||||||
|
&& ((PlayerInteractEvent.RightClickBlock) event)
|
||||||
|
.getUseItem() == Result.DENY)
|
||||||
|
|| event.getEntity().worldObj.isRemote)
|
||||||
|
return;
|
||||||
|
|
||||||
WorldEdit we = WorldEdit.getInstance();
|
WorldEdit we = WorldEdit.getInstance();
|
||||||
ForgePlayer player = wrap((EntityPlayerMP) event.entityPlayer);
|
ForgePlayer player = wrap((EntityPlayerMP) event.getEntityPlayer());
|
||||||
ForgeWorld world = getWorld(event.entityPlayer.worldObj);
|
ForgeWorld world = getWorld(event.getEntityPlayer().worldObj);
|
||||||
|
|
||||||
Action action = event.action;
|
if (event instanceof PlayerInteractEvent.LeftClickBlock) {
|
||||||
switch (action) {
|
@SuppressWarnings("deprecation")
|
||||||
case LEFT_CLICK_BLOCK: {
|
WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world),
|
||||||
WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), event.pos.getX(), event.pos.getY(), event.pos.getZ());
|
event.getPos().getX(), event.getPos().getY(), event.getPos().getZ());
|
||||||
|
|
||||||
if (we.handleBlockLeftClick(player, pos)) {
|
if (we.handleBlockLeftClick(player, pos)) {
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
|
||||||
|
|
||||||
if (we.handleArmSwing(player)) {
|
|
||||||
event.setCanceled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case RIGHT_CLICK_BLOCK: {
|
|
||||||
WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), event.pos.getX(), event.pos.getY(), event.pos.getZ());
|
|
||||||
|
|
||||||
if (we.handleBlockRightClick(player, pos)) {
|
if (we.handleArmSwing(player)) {
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
|
||||||
|
|
||||||
if (we.handleRightClick(player)) {
|
|
||||||
event.setCanceled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case RIGHT_CLICK_AIR: {
|
} else if (event instanceof PlayerInteractEvent.RightClickBlock) {
|
||||||
if (we.handleRightClick(player)) {
|
@SuppressWarnings("deprecation")
|
||||||
event.setCanceled(true);
|
WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world),
|
||||||
}
|
event.getPos().getX(), event.getPos().getY(), event.getPos().getZ());
|
||||||
|
|
||||||
break;
|
if (we.handleBlockRightClick(player, pos)) {
|
||||||
|
event.setCanceled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (we.handleRightClick(player)) {
|
||||||
|
event.setCanceled(true);
|
||||||
|
}
|
||||||
|
} else if (event instanceof PlayerInteractEvent.RightClickEmpty) {
|
||||||
|
if (we.handleRightClick(player)) {
|
||||||
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -201,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.getEnchantmentById(entry.getKey()), entry.getValue());
|
ret.addEnchantment(net.minecraft.enchantment.Enchantment.getEnchantmentByID(entry.getKey()), entry.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -213,7 +213,7 @@ final class NBTConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static CompoundTag fromNative(NBTTagCompound other) {
|
public static CompoundTag fromNative(NBTTagCompound other) {
|
||||||
@SuppressWarnings("unchecked") Set<String> tags = other.getKeySet();
|
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)));
|
||||||
|
@ -58,12 +58,11 @@ public class ThreadSafeCache {
|
|||||||
Set<UUID> onlineIds = new HashSet<UUID>();
|
Set<UUID> onlineIds = new HashSet<UUID>();
|
||||||
|
|
||||||
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
|
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
|
||||||
if (server == null || server.getConfigurationManager() == null) {
|
if (server == null || server.getPlayerList() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (Object object : FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList) {
|
for (EntityPlayerMP player : server.getPlayerList().getPlayerList()) {
|
||||||
if (object != null) {
|
if (player != null) {
|
||||||
EntityPlayerMP player = (EntityPlayerMP) object;
|
|
||||||
onlineIds.add(player.getUniqueID());
|
onlineIds.add(player.getUniqueID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,16 +21,14 @@ package com.sk89q.worldedit.forge;
|
|||||||
|
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
|
|
||||||
|
import java.lang.reflect.Constructor;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
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.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,7 +96,7 @@ 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 = TileEntity.createAndLoadEntity(tag);
|
TileEntity tileEntity = TileEntity.createTileEntity(world.getMinecraftServer(), tag);
|
||||||
if (tileEntity != null) {
|
if (tileEntity != null) {
|
||||||
world.setTileEntity(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()), tileEntity);
|
world.setTileEntity(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()), tileEntity);
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
|||||||
import net.minecraft.network.NetHandlerPlayServer;
|
import net.minecraft.network.NetHandlerPlayServer;
|
||||||
import net.minecraft.network.PacketBuffer;
|
import net.minecraft.network.PacketBuffer;
|
||||||
import net.minecraft.network.ThreadQuickExitException;
|
import net.minecraft.network.ThreadQuickExitException;
|
||||||
import net.minecraft.network.play.server.S3FPacketCustomPayload;
|
import net.minecraft.network.play.server.SPacketCustomPayload;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.network.FMLEventChannel;
|
import net.minecraftforge.fml.common.network.FMLEventChannel;
|
||||||
import net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientCustomPacketEvent;
|
import net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientCustomPacketEvent;
|
||||||
@ -44,7 +44,7 @@ public class WECUIPacketHandler {
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onPacketData(ServerCustomPacketEvent event) {
|
public void onPacketData(ServerCustomPacketEvent event) {
|
||||||
if (event.packet.channel().equals(ForgeWorldEdit.CUI_PLUGIN_CHANNEL)) {
|
if (event.getPacket().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,7 +52,7 @@ public class WECUIPacketHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String text = event.packet.payload().toString(UTF_8_CHARSET);
|
String text = event.getPacket().payload().toString(UTF_8_CHARSET);
|
||||||
session.handleCUIInitializationMessage(text);
|
session.handleCUIInitializationMessage(text);
|
||||||
session.describeCUI(ForgeWorldEdit.inst.wrap(player));
|
session.describeCUI(ForgeWorldEdit.inst.wrap(player));
|
||||||
}
|
}
|
||||||
@ -61,12 +61,12 @@ public class WECUIPacketHandler {
|
|||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void callProcessPacket(ClientCustomPacketEvent event) {
|
public void callProcessPacket(ClientCustomPacketEvent event) {
|
||||||
try {
|
try {
|
||||||
new S3FPacketCustomPayload(event.packet.channel(), new PacketBuffer(event.packet.payload())).processPacket(event.handler);
|
new SPacketCustomPayload(event.getPacket().channel(), new PacketBuffer(event.getPacket().payload())).processPacket(event.getHandler());
|
||||||
} catch (ThreadQuickExitException suppress) {
|
} catch (ThreadQuickExitException suppress) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static EntityPlayerMP getPlayerFromEvent(ServerCustomPacketEvent event) {
|
private static EntityPlayerMP getPlayerFromEvent(ServerCustomPacketEvent event) {
|
||||||
return ((NetHandlerPlayServer) event.handler).playerEntity;
|
return ((NetHandlerPlayServer) event.getHandler()).playerEntity;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -32,7 +32,6 @@ public class GuiReferenceCard extends GuiScreen {
|
|||||||
private int backgroundHeight = 256;
|
private int backgroundHeight = 256;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public void initGui() {
|
public void initGui() {
|
||||||
this.buttonList.add(this.closeButton = new GuiButton(0, (this.width - this.backgroundWidth + 100) / 2, (this.height + this.backgroundHeight - 60) / 2, this.backgroundWidth - 100, 20, "Close"));
|
this.buttonList.add(this.closeButton = new GuiButton(0, (this.width - this.backgroundWidth + 100) / 2, (this.height + this.backgroundHeight - 60) / 2, this.backgroundWidth - 100, 20, "Close"));
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
public net.minecraft.world.gen.ChunkProviderServer field_73248_b # droppedChunksSet
|
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_73244_f # id2ChunkMap
|
||||||
public net.minecraft.world.gen.ChunkProviderServer field_73245_g # loadedChunks
|
public net.minecraft.world.gen.ChunkProviderServer field_73245_g # loadedChunks
|
||||||
public net.minecraft.world.gen.ChunkProviderServer field_73246_d # serverChunkGenerator
|
public net.minecraft.world.gen.ChunkProviderServer field_186029_c # chunkGenerator
|
||||||
|
Loading…
Reference in New Issue
Block a user