Update to Forge 1.7.10-10.13.1.1225

Dieser Commit ist enthalten in:
Kenzie Togami 2014-10-12 12:27:51 -07:00
Ursprung 2214bcc948
Commit 1c89f4bffa
17 geänderte Dateien mit 167 neuen und 161 gelöschten Zeilen

Datei anzeigen

@ -2,10 +2,10 @@ language: java
notifications:
email: false
before_install: chmod +x gradlew
install: true
install: ./gradlew setupCIWorkspace -S
matrix:
include:
- jdk: oraclejdk7
script: mvn clean package
- jdk: oraclejdk7
script: gradle build
script: ./gradlew build -S

Datei anzeigen

@ -65,11 +65,12 @@ command:
Build WorldEdit for Forge with:
gradle setupDecompWorkspace
gradle build
Once complete, you will find the release .jar in the folder *build/libs*.
### Other Tasks
* `gradle setupDecompWorkspace idea` will generate an [IntelliJ IDEA](http://www.jetbrains.com/idea/) workspace
* `gradle setupDecompWorkspace eclipse` will generate an [Eclipse](https://www.eclipse.org/downloads/) workspace
* `gradle idea` will generate an [IntelliJ IDEA](http://www.jetbrains.com/idea/) workspace
* `gradle eclipse` will generate an [Eclipse](https://www.eclipse.org/downloads/) workspace

Datei anzeigen

@ -6,20 +6,27 @@
buildscript {
repositories {
mavenCentral()
maven { url = "http://files.minecraftforge.net/maven" }
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
jcenter()
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.0-SNAPSHOT'
classpath 'com.github.jengelman.gradle.plugins:shadow:0.8'
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
classpath 'com.github.jengelman.gradle.plugins:shadow:1.1.1'
}
}
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'forge'
apply plugin: 'shadow'
apply plugin: 'com.github.johnrengelman.shadow'
group = 'com.sk89q'
version = '6.0.0-SNAPSHOT' + System.getProperty("worldedit.build.suffix", "")
@ -66,8 +73,8 @@ sourceSets {
}
minecraft {
version = "1.6.4-9.11.1.964"
forgeVersion = "9.11.1.964"
ext.forgeVersion = "10.13.1.1225"
version = "1.7.10-$forgeVersion"
replaceIn "com/sk89q/worldedit/forge/ForgeWorldEdit.java"
replace "%VERSION%", project.version
@ -86,34 +93,29 @@ processResources {
}
// shade needed runtime dependencies
shadow {
//artifactAttached false
destinationDir "${buildDir}/libs/"
artifactSet {
include '*:jchronic:jar:'
include '*:paranamer:jar:'
include '*:jlibnoise:jar:'
shadowJar {
classifier 'shadow'
dependencies {
include(dependency('com.sk89q:jchronic:0.2.4a'))
include(dependency('com.thoughtworks.paranamer:paranamer:2.6'))
include(dependency('com.sk89q.lib:jlibnoise:1.0.0'))
}
exclude 'GradleStart**'
exclude '.cache'
}
// ensure reobf happens
reobf.reobf(shadowJar) { spec ->
spec.classpath = sourceSets.main.compileClasspath;
}
task deleteOrig(type: Delete) {
delete "${project.tasks.jar.getArchivePath().getPath()}"
}
task renameShaded(type: Copy) {
from file("${buildDir}/libs")
into file("${buildDir}/libs")
rename { String fileName ->
fileName.replace('-shadow', '')
}
delete project.tasks.jar.archivePath.getPath()
}
task deleteShaded(type: Delete) {
delete "${project.tasks.jar.getArchivePath().getPath().replace('.jar', '-shadow.jar')}"
delete project.tasks.shadowJar.archivePath.getPath()
}
// follow all the steps
build.dependsOn(deleteShaded)
deleteShaded.dependsOn(renameShaded)
renameShaded.dependsOn(deleteOrig)
deleteOrig.dependsOn(shadowJar)
shadowJar.dependsOn(deleteShaded)
build.dependsOn(shadowJar)

Datei anzeigen

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.11-bin.zip
distributionUrl=http\://services.gradle.org/distributions/gradle-2.0-bin.zip

Datei anzeigen

@ -19,13 +19,22 @@
package com.sk89q.worldedit.forge;
import com.google.common.base.Throwables;
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.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@ -36,7 +45,6 @@ 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();
@ -71,7 +79,7 @@ class ForgeBiomeRegistry implements BiomeRegistry {
Map<Integer, BiomeGenBase> biomes = HashBiMap.create();
Map<Integer, BiomeData> biomeData = new HashMap<Integer, BiomeData>();
for (BiomeGenBase biome : BiomeGenBase.biomeList) {
for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) {
if ((biome == null) || (biomes.containsValue(biome))) {
continue;
}

Datei anzeigen

@ -27,7 +27,7 @@ import net.minecraft.entity.INpc;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.item.EntityBoat;
import net.minecraft.entity.item.EntityEnderEye;
import net.minecraft.entity.item.EntityFallingSand;
import net.minecraft.entity.item.EntityFallingBlock;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityItemFrame;
import net.minecraft.entity.item.EntityMinecart;
@ -68,7 +68,7 @@ public class ForgeEntityType implements EntityType {
@Override
public boolean isFallingBlock() {
return entity instanceof EntityFallingSand;
return entity instanceof EntityFallingBlock;
}
@Override

Datei anzeigen

@ -20,8 +20,8 @@
package com.sk89q.worldedit.forge;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.ServerInterface;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.AbstractPlatform;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extension.platform.Capability;
import com.sk89q.worldedit.extension.platform.MultiUserPlatform;
@ -51,17 +51,15 @@ import java.util.EnumMap;
import java.util.List;
import java.util.Map;
class ForgePlatform extends ServerInterface implements MultiUserPlatform {
class ForgePlatform extends AbstractPlatform implements MultiUserPlatform {
private final ForgeWorldEdit mod;
private final MinecraftServer server;
private final ForgeBiomeRegistry biomes;
private boolean hookingEvents = false;
ForgePlatform(ForgeWorldEdit mod) {
this.mod = mod;
this.server = FMLCommonHandler.instance().getMinecraftServerInstance();
this.biomes = new ForgeBiomeRegistry();
}
boolean isHookingEvents() {
@ -71,16 +69,17 @@ class ForgePlatform extends ServerInterface implements MultiUserPlatform {
@Override
public int resolveItem(String name) {
if (name == null) return 0;
for (Item item : Item.itemsList) {
for (Object itemObj : Item.itemRegistry) {
Item item = (Item) itemObj;
if (item == null) continue;
if (item.getUnlocalizedName() == null) continue;
if (item.getUnlocalizedName().startsWith("item.")) {
if (item.getUnlocalizedName().equalsIgnoreCase("item." + name)) return item.itemID;
if (item.getUnlocalizedName().equalsIgnoreCase("item." + name)) return Item.getIdFromItem(item);
}
if (item.getUnlocalizedName().startsWith("tile.")) {
if (item.getUnlocalizedName().equalsIgnoreCase("tile." + name)) return item.itemID;
if (item.getUnlocalizedName().equalsIgnoreCase("tile." + name)) return Item.getIdFromItem(item);
}
if (item.getUnlocalizedName().equalsIgnoreCase(name)) return item.itemID;
if (item.getUnlocalizedName().equalsIgnoreCase(name)) return Item.getIdFromItem(item);
}
return 0;
}
@ -115,7 +114,7 @@ class ForgePlatform extends ServerInterface implements MultiUserPlatform {
if (player instanceof ForgePlayer) {
return player;
} else {
EntityPlayerMP entity = server.getConfigurationManager().getPlayerForUsername(player.getName());
EntityPlayerMP entity = server.getConfigurationManager().func_152612_a(player.getName());
return entity != null ? new ForgePlayer(entity) : null;
}
}
@ -143,7 +142,6 @@ class ForgePlatform extends ServerInterface implements MultiUserPlatform {
for (final CommandMapping command : dispatcher.getCommands()) {
final Description description = command.getDescription();
mcMan.registerCommand(new CommandBase() {
@Override
public String getCommandName() {
@ -220,7 +218,7 @@ class ForgePlatform extends ServerInterface implements MultiUserPlatform {
List<Actor> users = new ArrayList<Actor>();
ServerConfigurationManager scm = server.getConfigurationManager();
for (String name : scm.getAllUsernames()) {
EntityPlayerMP entity = scm.getPlayerForUsername(name);
EntityPlayerMP entity = scm.func_152612_a(name);
if (entity != null) {
users.add(new ForgePlayer(entity));
}

Datei anzeigen

@ -29,12 +29,15 @@ import com.sk89q.worldedit.internal.LocalWorldAdapter;
import com.sk89q.worldedit.internal.cui.CUIEvent;
import com.sk89q.worldedit.session.SessionKey;
import com.sk89q.worldedit.util.Location;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.util.ChatMessageComponent;
import net.minecraft.network.play.server.S3FPacketCustomPayload;
import net.minecraft.util.ChatComponentText;
import javax.annotation.Nullable;
import java.util.UUID;
public class ForgePlayer extends AbstractPlayerActor {
@ -54,12 +57,12 @@ public class ForgePlayer extends AbstractPlayerActor {
@Override
public int getItemInHand() {
ItemStack is = this.player.getCurrentEquippedItem();
return is == null ? 0 : is.itemID;
return is == null ? 0 : Item.getIdFromItem(is.getItem());
}
@Override
public String getName() {
return this.player.username;
return this.player.getCommandSenderName();
}
@Override
@ -99,7 +102,7 @@ public class ForgePlayer extends AbstractPlayerActor {
@Override
public void giveItem(int type, int amt) {
this.player.inventory.addItemStackToInventory(new ItemStack(type, amt, 0));
this.player.inventory.addItemStackToInventory(new ItemStack(Item.getItemById(type), amt, 0));
}
@Override
@ -109,35 +112,35 @@ public class ForgePlayer extends AbstractPlayerActor {
if (params.length > 0) {
send = send + "|" + StringUtil.joinString(params, "|");
}
Packet250CustomPayload packet = new Packet250CustomPayload(ForgeWorldEdit.CUI_PLUGIN_CHANNEL, send.getBytes(WECUIPacketHandler.UTF_8_CHARSET));
this.player.playerNetServerHandler.sendPacketToPlayer(packet);
S3FPacketCustomPayload packet = new S3FPacketCustomPayload(ForgeWorldEdit.CUI_PLUGIN_CHANNEL, send.getBytes(WECUIPacketHandler.UTF_8_CHARSET));
this.player.playerNetServerHandler.sendPacket(packet);
}
@Override
public void printRaw(String msg) {
for (String part : msg.split("\n")) {
this.player.sendChatToPlayer(ChatMessageComponent.createFromText(part));
this.player.addChatMessage(new ChatComponentText(part));
}
}
@Override
public void printDebug(String msg) {
for (String part : msg.split("\n")) {
this.player.sendChatToPlayer(ChatMessageComponent.createFromText("\u00a77" + part));
this.player.addChatMessage(new ChatComponentText("\u00a77" + part));
}
}
@Override
public void print(String msg) {
for (String part : msg.split("\n")) {
this.player.sendChatToPlayer(ChatMessageComponent.createFromText("\u00a7d" + part));
this.player.addChatMessage(new ChatComponentText("\u00a7d" + part));
}
}
@Override
public void printError(String msg) {
for (String part : msg.split("\n")) {
this.player.sendChatToPlayer(ChatMessageComponent.createFromText("\u00a7c" + part));
this.player.addChatMessage(new ChatComponentText("\u00a7c" + part));
}
}
@ -169,7 +172,7 @@ public class ForgePlayer extends AbstractPlayerActor {
@Override
public SessionKey getSessionKey() {
return new SessionKeyImpl(player.getUniqueID(), player.username);
return new SessionKeyImpl(player.getUniqueID(), player.getCommandSenderName());
}
private static class SessionKeyImpl implements SessionKey {

Datei anzeigen

@ -22,6 +22,7 @@ package com.sk89q.worldedit.forge;
import com.sk89q.worldedit.blocks.BaseItemStack;
import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import java.util.Map;
@ -33,11 +34,11 @@ public final class ForgeUtil {
public static boolean hasPermission(EntityPlayerMP player, String perm) {
// TODO fix WEPIF
return FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().isPlayerOpped(player.username);
return FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().func_152596_g(player.getGameProfile());
}
public static ItemStack toForgeItemStack(BaseItemStack item) {
ItemStack ret = new ItemStack(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()) {
ret.addEnchantment(net.minecraft.enchantment.Enchantment.enchantmentsList[((Integer) entry.getKey())], (Integer) entry.getValue());
}

Datei anzeigen

@ -129,10 +129,10 @@ public class ForgeWorld extends AbstractWorld {
int previousId = 0;
if (notifyAndLight) {
previousId = chunk.getBlockID(x & 15, y, z & 15);
previousId = Block.getIdFromBlock(chunk.getBlock(x & 15, y, z & 15));
}
boolean successful = chunk.setBlockIDWithMetadata(x & 15, y, z & 15, block.getId(), block.getData());
boolean successful = chunk.func_150807_a(x & 15, y, z & 15, Block.getBlockById(block.getId()), block.getData());
// Create the TileEntity
if (successful) {
@ -145,13 +145,13 @@ public class ForgeWorld extends AbstractWorld {
}
if (notifyAndLight) {
world.updateAllLightTypes(x, y, z);
world.func_147451_t(x, y, z);
world.markBlockForUpdate(x, y, z);
world.notifyBlockChange(x, y, z, previousId);
world.notifyBlockChange(x, y, z, Block.getBlockById(previousId));
Block mcBlock = Block.blocksList[block.getId()];
Block mcBlock = Block.getBlockById(previousId);
if (mcBlock != null && mcBlock.hasComparatorInputOverride()) {
world.func_96440_m(x, y, z, block.getId());
world.func_147453_f(x, y, z, Block.getBlockById(block.getId()));
}
}
@ -167,7 +167,7 @@ public class ForgeWorld extends AbstractWorld {
@Override
public boolean clearContainerBlockContents(Vector position) {
checkNotNull(position);
TileEntity tile = getWorld().getBlockTileEntity(position.getBlockX(), position.getBlockY(), position.getBlockZ());
TileEntity tile = getWorld().getTileEntity(position.getBlockX(), position.getBlockY(), position.getBlockZ());
if ((tile instanceof IInventory)) {
IInventory inv = (IInventory) tile;
int size = inv.getSizeInventory();
@ -322,15 +322,15 @@ public class ForgeWorld extends AbstractWorld {
@Override
public boolean isValidBlockType(int id) {
return (id == 0) || (net.minecraft.block.Block.blocksList[id] != null);
return (id == 0) || (net.minecraft.block.Block.getBlockById(id) != null);
}
@Override
public BaseBlock getBlock(Vector position) {
World world = getWorld();
int id = world.getBlockId(position.getBlockX(), position.getBlockY(), position.getBlockZ());
int id = Block.getIdFromBlock(world.getBlock(position.getBlockX(), position.getBlockY(), position.getBlockZ()));
int data = world.getBlockMetadata(position.getBlockX(), position.getBlockY(), position.getBlockZ());
TileEntity tile = getWorld().getBlockTileEntity(position.getBlockX(), position.getBlockY(), position.getBlockZ());
TileEntity tile = getWorld().getTileEntity(position.getBlockX(), position.getBlockY(), position.getBlockZ());
if (tile != null) {
return new TileEntityBaseBlock(id, data, tile);
@ -342,7 +342,7 @@ public class ForgeWorld extends AbstractWorld {
@Override
public BaseBlock getLazyBlock(Vector position) {
World world = getWorld();
int id = world.getBlockId(position.getBlockX(), position.getBlockY(), position.getBlockZ());
int id = Block.getIdFromBlock(world.getBlock(position.getBlockX(), position.getBlockY(), position.getBlockZ()));
int data = world.getBlockMetadata(position.getBlockX(), position.getBlockY(), position.getBlockZ());
return new LazyBlock(id, data, this, position);
}

Datei anzeigen

@ -28,7 +28,8 @@ import com.sk89q.worldedit.WorldVector;
import com.sk89q.worldedit.event.platform.PlatformReadyEvent;
import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.internal.LocalWorldAdapter;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
@ -38,15 +39,12 @@ 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.network.NetworkMod;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.CommandEvent;
import net.minecraftforge.event.Event.Result;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import javax.annotation.Nullable;
@ -54,8 +52,8 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Logger;
import static com.google.common.base.Preconditions.checkNotNull;
import static net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
@ -64,10 +62,9 @@ import static net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
* The Forge implementation of WorldEdit.
*/
@Mod(modid = "WorldEdit", name = "WorldEdit", version = "%VERSION%")
@NetworkMod(channels="WECUI", packetHandler=WECUIPacketHandler.class)
public class ForgeWorldEdit {
private static final Logger logger = Logger.getLogger(ForgeWorldEdit.class.getCanonicalName());
public static Logger logger;
public static final String CUI_PLUGIN_CHANNEL = "WECUI";
@Instance("WorldEdit")
@ -79,9 +76,7 @@ public class ForgeWorldEdit {
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
// Redirect all loggers under com.sk89q to FML's logger
Logger.getLogger("com.sk89q").setParent(FMLLog.getLogger());
logger = event.getModLog();
// Setup working directory
workingDir = new File(event.getModConfigurationDirectory() + File.separator + "worldedit");
workingDir.mkdir();
@ -92,7 +87,7 @@ public class ForgeWorldEdit {
config = new ForgeConfiguration(this);
config.load();
TickRegistry.registerTickHandler(ThreadSafeCache.getInstance(), Side.SERVER);
FMLCommonHandler.instance().bus().register(ThreadSafeCache.getInstance());
}
@EventHandler
@ -108,7 +103,7 @@ public class ForgeWorldEdit {
@EventHandler
public void serverAboutToStart(FMLServerAboutToStartEvent event) {
if (this.platform != null) {
logger.warning("FMLServerStartingEvent occurred when FMLServerStoppingEvent hasn't");
logger.warn("FMLServerStartingEvent occurred when FMLServerStoppingEvent hasn't");
WorldEdit.getInstance().getPlatformManager().unregister(platform);
}
@ -129,7 +124,7 @@ public class ForgeWorldEdit {
WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent());
}
@ForgeSubscribe
@SubscribeEvent
public void onCommandEvent(CommandEvent event) {
if ((event.sender instanceof EntityPlayerMP)) {
if (((EntityPlayerMP) event.sender).worldObj.isRemote) return;
@ -142,7 +137,7 @@ public class ForgeWorldEdit {
}
}
@ForgeSubscribe
@SubscribeEvent
public void onPlayerInteract(PlayerInteractEvent event) {
if (platform == null) {
return;
@ -278,7 +273,7 @@ public class ForgeWorldEdit {
ByteStreams.copy(inputStream, outputStream);
logger.info("Default configuration file written: " + name);
} catch (IOException e) {
logger.log(Level.WARNING, "Failed to extract defaults", e);
logger.log(Level.WARN, "Failed to extract defaults", e);
} finally {
try {
closer.close();

Datei anzeigen

@ -76,11 +76,11 @@ final class NBTConverter {
public static NBTTagIntArray toNative(IntArrayTag tag) {
int[] value = tag.getValue();
return new NBTTagIntArray(tag.getName(), Arrays.copyOf(value, value.length));
return new NBTTagIntArray(Arrays.copyOf(value, value.length));
}
public static NBTTagList toNative(ListTag tag) {
NBTTagList list = new NBTTagList(tag.getName());
NBTTagList list = new NBTTagList();
for (Tag child : tag.getValue()) {
if (child instanceof EndTag) {
continue;
@ -95,28 +95,28 @@ final class NBTConverter {
}
public static NBTTagLong toNative(LongTag tag) {
return new NBTTagLong(tag.getName(), tag.getValue());
return new NBTTagLong(tag.getValue());
}
public static NBTTagString toNative(StringTag tag) {
return new NBTTagString(tag.getName(), tag.getValue());
return new NBTTagString(tag.getValue());
}
public static NBTTagInt toNative(IntTag tag) {
return new NBTTagInt(tag.getName(), tag.getValue());
return new NBTTagInt(tag.getValue());
}
public static NBTTagByte toNative(ByteTag tag) {
return new NBTTagByte(tag.getName(), tag.getValue());
return new NBTTagByte(tag.getValue());
}
public static NBTTagByteArray toNative(ByteArrayTag tag) {
byte[] value = tag.getValue();
return new NBTTagByteArray(tag.getName(), Arrays.copyOf(value, value.length));
return new NBTTagByteArray(Arrays.copyOf(value, value.length));
}
public static NBTTagCompound toNative(CompoundTag tag) {
NBTTagCompound compound = new NBTTagCompound(tag.getName());
NBTTagCompound compound = new NBTTagCompound();
for (Entry<String, Tag> child : tag.getValue().entrySet()) {
compound.setTag(child.getKey(), toNative(child.getValue()));
}
@ -124,15 +124,15 @@ final class NBTConverter {
}
public static NBTTagFloat toNative(FloatTag tag) {
return new NBTTagFloat(tag.getName(), tag.getValue());
return new NBTTagFloat(tag.getValue());
}
public static NBTTagShort toNative(ShortTag tag) {
return new NBTTagShort(tag.getName(), tag.getValue());
return new NBTTagShort(tag.getValue());
}
public static NBTTagDouble toNative(DoubleTag tag) {
return new NBTTagDouble(tag.getName(), tag.getValue());
return new NBTTagDouble(tag.getValue());
}
public static Tag fromNative(NBTBase other) {
@ -177,22 +177,20 @@ final class NBTConverter {
}
public static IntArrayTag fromNative(NBTTagIntArray other) {
int[] value = other.intArray;
return new IntArrayTag(other.getName(), Arrays.copyOf(value, value.length));
int[] value = other.func_150302_c();
return new IntArrayTag(Arrays.copyOf(value, value.length));
}
public static ListTag fromNative(NBTTagList other) {
other = (NBTTagList) other.copy();
List<Tag> list = new ArrayList<Tag>();
Class<? extends Tag> listClass = StringTag.class;
for (int i = 0; i < other.tagCount(); i++) {
if (other.tagAt(i) instanceof NBTTagEnd) {
continue;
}
Tag child = fromNative(other.tagAt(i));
Tag child = fromNative(other.removeTag(0));
list.add(child);
listClass = child.getClass();
}
return new ListTag(other.getName(), listClass, list);
return new ListTag(listClass, list);
}
public static EndTag fromNative(NBTTagEnd other) {
@ -200,45 +198,45 @@ final class NBTConverter {
}
public static LongTag fromNative(NBTTagLong other) {
return new LongTag(other.getName(), other.data);
return new LongTag(other.func_150291_c());
}
public static StringTag fromNative(NBTTagString other) {
return new StringTag(other.getName(), other.data);
return new StringTag(other.func_150285_a_());
}
public static IntTag fromNative(NBTTagInt other) {
return new IntTag(other.getName(), other.data);
return new IntTag(other.func_150287_d());
}
public static ByteTag fromNative(NBTTagByte other) {
return new ByteTag(other.getName(), other.data);
return new ByteTag(other.func_150290_f());
}
public static ByteArrayTag fromNative(NBTTagByteArray other) {
byte[] value = other.byteArray;
return new ByteArrayTag(other.getName(), Arrays.copyOf(value, value.length));
byte[] value = other.func_150292_c();
return new ByteArrayTag(Arrays.copyOf(value, value.length));
}
public static CompoundTag fromNative(NBTTagCompound other) {
@SuppressWarnings("unchecked") Collection<NBTBase> tags = other.getTags();
@SuppressWarnings("unchecked") Collection<String> tags = other.func_150296_c();
Map<String, Tag> map = new HashMap<String, Tag>();
for (NBTBase tag : tags) {
map.put(tag.getName(), fromNative(tag));
for (String tagName : tags) {
map.put(tagName, fromNative(other.getTag(tagName)));
}
return new CompoundTag(other.getName(), map);
return new CompoundTag(map);
}
public static FloatTag fromNative(NBTTagFloat other) {
return new FloatTag(other.getName(), other.data);
return new FloatTag(other.func_150288_h());
}
public static ShortTag fromNative(NBTTagShort other) {
return new ShortTag(other.getName(), other.data);
return new ShortTag(other.func_150289_e());
}
public static DoubleTag fromNative(NBTTagDouble other) {
return new DoubleTag(other.getName(), other.data);
return new DoubleTag(other.func_150286_g());
}
}

Datei anzeigen

@ -20,12 +20,11 @@
package com.sk89q.worldedit.forge;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import net.minecraft.entity.player.EntityPlayerMP;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
@ -34,7 +33,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
/**
* Caches data that cannot be accessed from another thread safely.
*/
class ThreadSafeCache implements ITickHandler {
public class ThreadSafeCache {
private static final long REFRESH_DELAY = 1000 * 30;
private static final ThreadSafeCache INSTANCE = new ThreadSafeCache();
@ -50,13 +49,16 @@ class ThreadSafeCache implements ITickHandler {
return onlineIds;
}
@Override
public void tickStart(EnumSet<TickType> type, Object... tickData) {
@SubscribeEvent
public void tickStart(TickEvent event) {
long now = System.currentTimeMillis();
if (now - lastRefresh > REFRESH_DELAY) {
Set<UUID> onlineIds = new HashSet<UUID>();
if (FMLCommonHandler.instance().getMinecraftServerInstance() == null) {
return;
}
for (Object object : FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList) {
if (object != null) {
EntityPlayerMP player = (EntityPlayerMP) object;
@ -70,20 +72,6 @@ class ThreadSafeCache implements ITickHandler {
}
}
@Override
public void tickEnd(EnumSet<TickType> type, Object... tickData) {
}
@Override
public EnumSet<TickType> ticks() {
return EnumSet.of(TickType.SERVER);
}
@Override
public String getLabel() {
return "WorldEdit Cache";
}
public static ThreadSafeCache getInstance() {
return INSTANCE;
}

Datei anzeigen

@ -49,9 +49,9 @@ final class TileEntityUtils {
checkNotNull(tag);
checkNotNull(position);
tag.setTag("x", new NBTTagInt("x", position.getBlockX()));
tag.setTag("y", new NBTTagInt("y", position.getBlockY()));
tag.setTag("z", new NBTTagInt("z", position.getBlockZ()));
tag.setTag("x", new NBTTagInt(position.getBlockX()));
tag.setTag("y", new NBTTagInt(position.getBlockY()));
tag.setTag("z", new NBTTagInt(position.getBlockZ()));
return tag;
}
@ -81,7 +81,7 @@ final class TileEntityUtils {
tileEntity.readFromNBT(tag);
}
world.setBlockTileEntity(position.getBlockX(), position.getBlockY(), position.getBlockZ(), tileEntity);
world.setTileEntity(position.getBlockX(), position.getBlockY(), position.getBlockZ(), tileEntity);
}
/**
@ -97,7 +97,7 @@ final class TileEntityUtils {
updateForSet(tag, position);
TileEntity tileEntity = TileEntity.createAndLoadEntity(tag);
if (tileEntity != null) {
world.setBlockTileEntity(position.getBlockX(), position.getBlockY(), position.getBlockZ(), tileEntity);
world.setTileEntity(position.getBlockX(), position.getBlockY(), position.getBlockZ(), tileEntity);
}
}
}

Datei anzeigen

@ -22,28 +22,42 @@ package com.sk89q.worldedit.forge;
import java.nio.charset.Charset;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.network.play.client.C17PacketCustomPayload;
import com.sk89q.worldedit.LocalSession;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.FMLEventChannel;
import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
public class WECUIPacketHandler implements IPacketHandler {
public class WECUIPacketHandler {
public static final Charset UTF_8_CHARSET = Charset.forName("UTF-8");
private static FMLEventChannel WECUI_CHANNEL;
public static void init() {
WECUI_CHANNEL = NetworkRegistry.INSTANCE.newEventDrivenChannel(ForgeWorldEdit.CUI_PLUGIN_CHANNEL);
WECUI_CHANNEL.register(new WECUIPacketHandler());
}
@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) {
if (player instanceof EntityPlayerMP) {
@SubscribeEvent
public void onPacketData(ServerCustomPacketEvent event) {
C17PacketCustomPayload rawPacket = (C17PacketCustomPayload) event.packet.toC17Packet();
if (event.packet.channel().equals(ForgeWorldEdit.CUI_PLUGIN_CHANNEL)) {
EntityPlayerMP player = getPlayerFromEvent(event);
LocalSession session = ForgeWorldEdit.inst.getSession((EntityPlayerMP) player);
if (session.hasCUISupport()) {
return;
}
String text = new String(packet.data, UTF_8_CHARSET);
String text = new String(rawPacket.func_149558_e(), UTF_8_CHARSET);
session.handleCUIInitializationMessage(text);
}
}
private static EntityPlayerMP getPlayerFromEvent(ServerCustomPacketEvent event) {
return ((NetHandlerPlayServer) event.handler).playerEntity;
}
}

Datei anzeigen

@ -1,6 +1,4 @@
{
"modinfoversion": 2,
"modlist": [{
[{
"modid": "WorldEdit",
"name": "WorldEdit",
"description": "WorldEdit is an easy-to-use in-game world editor for Minecraft, supporting both single player and multiplayer.",
@ -19,5 +17,4 @@
"Forge@[${forgeVersion},)"
],
"dependants": []
}]
}
}]

Datei anzeigen

@ -51,6 +51,7 @@
<allow pkg="cpw"/>
<allow pkg="net.minecraft"/>
<allow pkg="net.minecraftforge"/>
<allow pkg="org.apache.logging.log4j"/>
</subpackage>
</subpackage>
</import-control>