geforkt von Mirrors/FastAsyncWorldEdit
Switch to Forge 1.9 (12.16.0.1770)
Dieser Commit ist enthalten in:
Ursprung
5b38f460d4
Commit
ecc4948668
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 Feb 22 17:40:44 PST 2016
|
||||
#Thu May 05 15:11:12 PDT 2016
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
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.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
# 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
|
||||
|
||||
APP_NAME="Gradle"
|
||||
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.
|
||||
MAX_FD="maximum"
|
||||
|
||||
@ -30,6 +48,7 @@ die ( ) {
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
@ -40,26 +59,11 @@ case "`uname`" in
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
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
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
@ -85,7 +89,7 @@ location of your Java installation."
|
||||
fi
|
||||
|
||||
# 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`
|
||||
if [ $? -eq 0 ] ; 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
|
||||
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
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
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
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
|
@ -27,12 +27,12 @@ repositories {
|
||||
}
|
||||
|
||||
version = "6.1.1"
|
||||
ext.forgeVersion = "11.15.1.1760"
|
||||
ext.forgeVersion = "12.16.1.1891"
|
||||
ext.internalVersion = version + ";" + gitCommitHash
|
||||
|
||||
minecraft {
|
||||
version = "1.8.9-${project.forgeVersion}"
|
||||
mappings = "snapshot_20160111"
|
||||
version = "1.9-${project.forgeVersion}"
|
||||
mappings = "snapshot_20160505"
|
||||
runDir = 'run'
|
||||
|
||||
replaceIn "com/sk89q/worldedit/forge/ForgeWorldEdit.java"
|
||||
|
@ -25,8 +25,10 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
public class CommandWrapper extends CommandBase {
|
||||
private CommandMapping command;
|
||||
@ -46,7 +48,8 @@ public class CommandWrapper extends CommandBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender var1, String[] var2) {}
|
||||
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandUsage(ICommandSender icommandsender) {
|
||||
@ -59,7 +62,7 @@ public class CommandWrapper extends CommandBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCommandSenderUseCommand(ICommandSender sender) {
|
||||
public boolean checkPermission(MinecraftServer server, ICommandSender sender) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,9 @@ package com.sk89q.worldedit.forge;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
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 {
|
||||
|
||||
@ -33,7 +34,7 @@ final class ForgeAdapter {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -41,8 +42,8 @@ final class ForgeAdapter {
|
||||
return new Vector(pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
public static Vec3 toVec3(Vector vector) {
|
||||
return new Vec3(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ());
|
||||
public static Vec3d toVec3(Vector vector) {
|
||||
return new Vec3d(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ());
|
||||
}
|
||||
|
||||
public static BlockPos toBlockPos(Vector vector) {
|
||||
|
@ -19,29 +19,20 @@
|
||||
|
||||
package com.sk89q.worldedit.forge;
|
||||
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.biome.BiomeData;
|
||||
import com.sk89q.worldedit.world.registry.BiomeRegistry;
|
||||
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Provides access to biome data in Forge.
|
||||
*/
|
||||
class ForgeBiomeRegistry implements BiomeRegistry {
|
||||
private static Map<Integer, BiomeGenBase> biomes = Collections.emptyMap();
|
||||
private static Map<Integer, BiomeData> biomeData = Collections.emptyMap();
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BaseBiome createFromId(int id) {
|
||||
return new BaseBiome(id);
|
||||
@ -50,38 +41,15 @@ class ForgeBiomeRegistry implements BiomeRegistry {
|
||||
@Override
|
||||
public List<BaseBiome> getBiomes() {
|
||||
List<BaseBiome> list = new ArrayList<BaseBiome>();
|
||||
for (int biome : biomes.keySet()) {
|
||||
list.add(new BaseBiome(biome));
|
||||
for (BiomeGenBase biome : BiomeGenBase.REGISTRY) {
|
||||
list.add(new BaseBiome(BiomeGenBase.getIdForBiome(biome)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BiomeData getData(BaseBiome biome) {
|
||||
return biomeData.get(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;
|
||||
return new ForgeBiomeData(BiomeGenBase.getBiome(biome.getId()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -101,7 +69,7 @@ class ForgeBiomeRegistry implements BiomeRegistry {
|
||||
|
||||
@Override
|
||||
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.INpc;
|
||||
import net.minecraft.entity.IProjectile;
|
||||
import net.minecraft.entity.item.EntityArmorStand;
|
||||
import net.minecraft.entity.item.EntityBoat;
|
||||
import net.minecraft.entity.item.EntityEnderEye;
|
||||
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.EntityAnimal;
|
||||
import net.minecraft.entity.passive.EntityTameable;
|
||||
import net.minecraft.entity.passive.IAnimals;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
@ -139,6 +139,6 @@ public class ForgeEntityType implements EntityType {
|
||||
|
||||
@Override
|
||||
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) {
|
||||
ForgeConfiguration configuration = platform.getConfiguration();
|
||||
return configuration.cheatMode ||
|
||||
FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().canSendCommands(player.getGameProfile()) ||
|
||||
(configuration.creativeEnable && player.theItemInWorldManager.getGameType() == GameType.CREATIVE);
|
||||
FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().canSendCommands(player.getGameProfile()) ||
|
||||
(configuration.creativeEnable && player.interactionManager.getGameType() == GameType.CREATIVE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -35,7 +35,7 @@ import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.management.ServerConfigurationManager;
|
||||
import net.minecraft.server.management.PlayerList;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
@ -43,7 +43,6 @@ import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
@ -77,8 +76,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform {
|
||||
}
|
||||
}
|
||||
|
||||
for (Object itemObj : Item.itemRegistry) {
|
||||
Item item = (Item) itemObj;
|
||||
for (Item item : Item.REGISTRY) {
|
||||
if (item == null) continue;
|
||||
if (item.getUnlocalizedName() == null) continue;
|
||||
if (item.getUnlocalizedName().startsWith("item.")) {
|
||||
@ -94,7 +92,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform {
|
||||
|
||||
@Override
|
||||
public boolean isValidMobType(String type) {
|
||||
return EntityList.stringToClassMapping.containsKey(type);
|
||||
return EntityList.NAME_TO_CLASS.containsKey(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -109,8 +107,8 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform {
|
||||
|
||||
@Override
|
||||
public List<? extends com.sk89q.worldedit.world.World> getWorlds() {
|
||||
List<WorldServer> worlds = Arrays.asList(DimensionManager.getWorlds());
|
||||
List<com.sk89q.worldedit.world.World> ret = new ArrayList<com.sk89q.worldedit.world.World>(worlds.size());
|
||||
WorldServer[] worlds = DimensionManager.getWorlds();
|
||||
List<com.sk89q.worldedit.world.World> ret = new ArrayList<com.sk89q.worldedit.world.World>(worlds.length);
|
||||
for (WorldServer world : worlds) {
|
||||
ret.add(new ForgeWorld(world));
|
||||
}
|
||||
@ -123,7 +121,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform {
|
||||
if (player instanceof ForgePlayer) {
|
||||
return player;
|
||||
} else {
|
||||
EntityPlayerMP entity = server.getConfigurationManager().getPlayerByUsername(player.getName());
|
||||
EntityPlayerMP entity = server.getPlayerList().getPlayerByUsername(player.getName());
|
||||
return entity != null ? new ForgePlayer(this, entity) : null;
|
||||
}
|
||||
}
|
||||
@ -202,9 +200,8 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform {
|
||||
@Override
|
||||
public Collection<Actor> getConnectedUsers() {
|
||||
List<Actor> users = new ArrayList<Actor>();
|
||||
ServerConfigurationManager scm = server.getConfigurationManager();
|
||||
for (String name : scm.getAllUsernames()) {
|
||||
EntityPlayerMP entity = scm.getPlayerByUsername(name);
|
||||
PlayerList scm = server.getPlayerList();
|
||||
for (EntityPlayerMP entity : scm.getPlayerList()) {
|
||||
if (entity != null) {
|
||||
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.util.Location;
|
||||
|
||||
import io.netty.buffer.Unpooled;
|
||||
import java.util.UUID;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.network.play.server.S3FPacketCustomPayload;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.UUID;
|
||||
import net.minecraft.network.play.server.SPacketCustomPayload;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
public class ForgePlayer extends AbstractPlayerActor {
|
||||
|
||||
@ -61,7 +60,7 @@ public class ForgePlayer extends AbstractPlayerActor {
|
||||
|
||||
@Override
|
||||
public int getItemInHand() {
|
||||
ItemStack is = this.player.getCurrentEquippedItem();
|
||||
ItemStack is = this.player.getHeldItem(EnumHand.MAIN_HAND);
|
||||
return is == null ? 0 : Item.getIdFromItem(is.getItem());
|
||||
}
|
||||
|
||||
@ -85,6 +84,7 @@ public class ForgePlayer extends AbstractPlayerActor {
|
||||
this.player.rotationPitch);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public WorldVector getPosition() {
|
||||
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, "|");
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printRaw(String msg) {
|
||||
for (String part : msg.split("\n")) {
|
||||
this.player.addChatMessage(new ChatComponentText(part));
|
||||
this.player.addChatMessage(new TextComponentString(part));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printDebug(String msg) {
|
||||
sendColorized(msg, EnumChatFormatting.GRAY);
|
||||
sendColorized(msg, TextFormatting.GRAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void print(String msg) {
|
||||
sendColorized(msg, EnumChatFormatting.LIGHT_PURPLE);
|
||||
sendColorized(msg, TextFormatting.LIGHT_PURPLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
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")) {
|
||||
ChatComponentText component = new ChatComponentText(part);
|
||||
component.getChatStyle().setColor(formatting);
|
||||
TextComponentString component = new TextComponentString(part);
|
||||
component.getStyle().setColor(formatting);
|
||||
this.player.addChatMessage(component);
|
||||
}
|
||||
}
|
||||
|
@ -58,16 +58,17 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
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.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraft.world.gen.ChunkProviderServer;
|
||||
import net.minecraft.world.gen.feature.WorldGenBigMushroom;
|
||||
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.WorldGenForest;
|
||||
import net.minecraft.world.gen.feature.WorldGenMegaJungle;
|
||||
import net.minecraft.world.gen.feature.WorldGenMegaPineTree;
|
||||
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 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 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;
|
||||
|
||||
@ -204,7 +205,7 @@ public class ForgeWorld extends AbstractWorld {
|
||||
@Override
|
||||
public BaseBiome getBiome(Vector2D 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
|
||||
@ -258,8 +259,6 @@ public class ForgeWorld extends AbstractWorld {
|
||||
return false;
|
||||
}
|
||||
ChunkProviderServer chunkServer = (ChunkProviderServer) provider;
|
||||
IChunkProvider chunkProvider = chunkServer.serverChunkGenerator;
|
||||
|
||||
for (Vector2D coord : chunks) {
|
||||
long pos = ChunkCoordIntPair.chunkXZ2Int(coord.getBlockX(), coord.getBlockZ());
|
||||
Chunk mcChunk;
|
||||
@ -269,12 +268,12 @@ public class ForgeWorld extends AbstractWorld {
|
||||
}
|
||||
chunkServer.droppedChunksSet.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.loadedChunks.add(mcChunk);
|
||||
if (mcChunk != null) {
|
||||
mcChunk.onChunkLoad();
|
||||
mcChunk.populateChunk(chunkProvider, chunkProvider, coord.getBlockX(), coord.getBlockZ());
|
||||
mcChunk.populateChunk(chunkServer, chunkServer.chunkGenerator);
|
||||
}
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
@ -308,18 +307,18 @@ public class ForgeWorld extends AbstractWorld {
|
||||
case BIG_TREE: return new WorldGenBigTree(true);
|
||||
case REDWOOD: return new WorldGenTaiga2(true);
|
||||
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 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 JUNGLE_BUSH: return new WorldGenShrub(JUNGLE_LOG, JUNGLE_SHRUB);
|
||||
case RED_MUSHROOM: return new WorldGenBigMushroom(Blocks.brown_mushroom_block);
|
||||
case BROWN_MUSHROOM: return new WorldGenBigMushroom(Blocks.red_mushroom_block);
|
||||
case RED_MUSHROOM: return new WorldGenBigMushroom(Blocks.BROWN_MUSHROOM_BLOCK);
|
||||
case BROWN_MUSHROOM: return new WorldGenBigMushroom(Blocks.RED_MUSHROOM_BLOCK);
|
||||
case SWAMP: return new WorldGenSwamp();
|
||||
case ACACIA: return new WorldGenSavannaTree(true);
|
||||
case DARK_OAK: return new WorldGenCanopyTree(true);
|
||||
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 PINE:
|
||||
case RANDOM_REDWOOD:
|
||||
@ -390,9 +389,7 @@ public class ForgeWorld extends AbstractWorld {
|
||||
@Override
|
||||
public List<? extends Entity> getEntities(Region region) {
|
||||
List<Entity> entities = new ArrayList<Entity>();
|
||||
World world = getWorld();
|
||||
List<net.minecraft.entity.Entity> ents = world.loadedEntityList;
|
||||
for (net.minecraft.entity.Entity entity : ents) {
|
||||
for (net.minecraft.entity.Entity entity : getWorld().loadedEntityList) {
|
||||
if (region.contains(new Vector(entity.posX, entity.posY, entity.posZ))) {
|
||||
entities.add(new ForgeEntity(entity));
|
||||
}
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.forge;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
@ -39,7 +41,6 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.CommandEvent;
|
||||
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.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
@ -110,8 +111,6 @@ public class ForgeWorldEdit {
|
||||
WorldEdit.getInstance().getPlatformManager().unregister(platform);
|
||||
}
|
||||
|
||||
ForgeBiomeRegistry.populate();
|
||||
|
||||
this.platform = new ForgePlatform(this);
|
||||
|
||||
WorldEdit.getInstance().getPlatformManager().register(platform);
|
||||
@ -135,13 +134,13 @@ public class ForgeWorldEdit {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onCommandEvent(CommandEvent event) {
|
||||
if ((event.sender instanceof EntityPlayerMP)) {
|
||||
if (((EntityPlayerMP) event.sender).worldObj.isRemote) return;
|
||||
String[] split = new String[event.parameters.length + 1];
|
||||
System.arraycopy(event.parameters, 0, split, 1, event.parameters.length);
|
||||
split[0] = event.command.getCommandName();
|
||||
if ((event.getSender() instanceof EntityPlayerMP)) {
|
||||
if (((EntityPlayerMP) event.getSender()).worldObj.isRemote) return;
|
||||
String[] split = new String[event.getParameters().length + 1];
|
||||
System.arraycopy(event.getParameters(), 0, split, 1, event.getParameters().length);
|
||||
split[0] = event.getCommand().getCommandName();
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -152,18 +151,26 @@ public class ForgeWorldEdit {
|
||||
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();
|
||||
ForgePlayer player = wrap((EntityPlayerMP) event.entityPlayer);
|
||||
ForgeWorld world = getWorld(event.entityPlayer.worldObj);
|
||||
ForgePlayer player = wrap((EntityPlayerMP) event.getEntityPlayer());
|
||||
ForgeWorld world = getWorld(event.getEntityPlayer().worldObj);
|
||||
|
||||
Action action = event.action;
|
||||
switch (action) {
|
||||
case LEFT_CLICK_BLOCK: {
|
||||
WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), event.pos.getX(), event.pos.getY(), event.pos.getZ());
|
||||
if (event instanceof PlayerInteractEvent.LeftClickBlock) {
|
||||
@SuppressWarnings("deprecation")
|
||||
WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world),
|
||||
event.getPos().getX(), event.getPos().getY(), event.getPos().getZ());
|
||||
|
||||
if (we.handleBlockLeftClick(player, pos)) {
|
||||
event.setCanceled(true);
|
||||
@ -172,11 +179,10 @@ public class ForgeWorldEdit {
|
||||
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());
|
||||
} else if (event instanceof PlayerInteractEvent.RightClickBlock) {
|
||||
@SuppressWarnings("deprecation")
|
||||
WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world),
|
||||
event.getPos().getX(), event.getPos().getY(), event.getPos().getZ());
|
||||
|
||||
if (we.handleBlockRightClick(player, pos)) {
|
||||
event.setCanceled(true);
|
||||
@ -185,23 +191,17 @@ public class ForgeWorldEdit {
|
||||
if (we.handleRightClick(player)) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case RIGHT_CLICK_AIR: {
|
||||
} else if (event instanceof PlayerInteractEvent.RightClickEmpty) {
|
||||
if (we.handleRightClick(player)) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack toForgeItemStack(BaseItemStack item) {
|
||||
ItemStack ret = new ItemStack(Item.getItemById(item.getType()), item.getAmount(), item.getData());
|
||||
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;
|
||||
|
@ -213,7 +213,7 @@ final class NBTConverter {
|
||||
}
|
||||
|
||||
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>();
|
||||
for (String tagName : tags) {
|
||||
map.put(tagName, fromNative(other.getTag(tagName)));
|
||||
|
@ -58,12 +58,11 @@ public class ThreadSafeCache {
|
||||
Set<UUID> onlineIds = new HashSet<UUID>();
|
||||
|
||||
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
|
||||
if (server == null || server.getConfigurationManager() == null) {
|
||||
if (server == null || server.getPlayerList() == null) {
|
||||
return;
|
||||
}
|
||||
for (Object object : FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList) {
|
||||
if (object != null) {
|
||||
EntityPlayerMP player = (EntityPlayerMP) object;
|
||||
for (EntityPlayerMP player : server.getPlayerList().getPlayerList()) {
|
||||
if (player != null) {
|
||||
onlineIds.add(player.getUniqueID());
|
||||
}
|
||||
}
|
||||
|
@ -21,16 +21,14 @@ package com.sk89q.worldedit.forge;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagInt;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
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) {
|
||||
if (tag != null) {
|
||||
updateForSet(tag, position);
|
||||
TileEntity tileEntity = TileEntity.createAndLoadEntity(tag);
|
||||
TileEntity tileEntity = TileEntity.createTileEntity(world.getMinecraftServer(), tag);
|
||||
if (tileEntity != null) {
|
||||
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.PacketBuffer;
|
||||
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.network.FMLEventChannel;
|
||||
import net.minecraftforge.fml.common.network.FMLNetworkEvent.ClientCustomPacketEvent;
|
||||
@ -44,7 +44,7 @@ public class WECUIPacketHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
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);
|
||||
LocalSession session = ForgeWorldEdit.inst.getSession((EntityPlayerMP) player);
|
||||
|
||||
@ -52,7 +52,7 @@ public class WECUIPacketHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
String text = event.packet.payload().toString(UTF_8_CHARSET);
|
||||
String text = event.getPacket().payload().toString(UTF_8_CHARSET);
|
||||
session.handleCUIInitializationMessage(text);
|
||||
session.describeCUI(ForgeWorldEdit.inst.wrap(player));
|
||||
}
|
||||
@ -61,12 +61,12 @@ public class WECUIPacketHandler {
|
||||
@SubscribeEvent
|
||||
public void callProcessPacket(ClientCustomPacketEvent event) {
|
||||
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) {
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
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"));
|
||||
}
|
||||
|
@ -1,4 +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
|
||||
public net.minecraft.world.gen.ChunkProviderServer field_186029_c # chunkGenerator
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren