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

[Forge] Update to 1.8

Dieser Commit ist enthalten in:
Kenzie Togami 2015-01-15 19:39:15 -08:00
Ursprung 23d6fa7579
Commit ba363bce20
16 geänderte Dateien mit 104 neuen und 87 gelöschten Zeilen

Datei anzeigen

@ -54,6 +54,7 @@
<allow pkg="com.mojang.authlib"/> <allow pkg="com.mojang.authlib"/>
<allow pkg="org.apache.logging.log4j"/> <allow pkg="org.apache.logging.log4j"/>
<allow pkg="org.lwjgl"/> <allow pkg="org.lwjgl"/>
<allow pkg="io.netty.buffer"/>
</subpackage> </subpackage>
</subpackage> </subpackage>
</import-control> </import-control>

Datei anzeigen

@ -19,8 +19,8 @@ dependencies {
} }
minecraft { minecraft {
ext.forgeVersion = "10.13.1.1225" ext.forgeVersion = "11.14.0.1281"
version = "1.7.10-$forgeVersion" version = "1.8-$forgeVersion-1.8"
replaceIn "com/sk89q/worldedit/forge/ForgeWorldEdit.java" replaceIn "com/sk89q/worldedit/forge/ForgeWorldEdit.java"
replace "%VERSION%", project.version replace "%VERSION%", project.version

Datei anzeigen

@ -19,7 +19,7 @@
package com.sk89q.worldedit.forge; package com.sk89q.worldedit.forge;
import cpw.mods.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLCommonHandler;
public class ClientProxy extends CommonProxy { public class ClientProxy extends CommonProxy {

Datei anzeigen

@ -19,8 +19,9 @@
package com.sk89q.worldedit.forge; package com.sk89q.worldedit.forge;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import com.sk89q.worldedit.forge.gui.GuiHandler; import com.sk89q.worldedit.forge.gui.GuiHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
public class CommonProxy { public class CommonProxy {

Datei anzeigen

@ -133,7 +133,7 @@ public class ForgeEntityType implements EntityType {
@Override @Override
public boolean isTagged() { public boolean isTagged() {
return entity instanceof EntityLiving && ((EntityLiving) entity).hasCustomNameTag(); return entity instanceof EntityLiving && ((EntityLiving) entity).hasCustomName();
} }
@Override @Override

Datei anzeigen

@ -19,10 +19,10 @@
package com.sk89q.worldedit.forge; package com.sk89q.worldedit.forge;
import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraft.command.ICommand; import net.minecraft.command.ICommand;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.world.WorldSettings.GameType; import net.minecraft.world.WorldSettings.GameType;
import net.minecraftforge.fml.common.FMLCommonHandler;
public interface ForgePermissionsProvider { public interface ForgePermissionsProvider {
@ -42,7 +42,7 @@ public interface ForgePermissionsProvider {
public boolean hasPermission(EntityPlayerMP player, String permission) { public boolean hasPermission(EntityPlayerMP player, String permission) {
ForgeConfiguration configuration = platform.getConfiguration(); ForgeConfiguration configuration = platform.getConfiguration();
return configuration.cheatMode || return configuration.cheatMode ||
FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().func_152596_g(player.getGameProfile()) || FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().canSendCommands(player.getGameProfile()) ||
(configuration.creativeEnable && player.theItemInWorldManager.getGameType() == GameType.CREATIVE); (configuration.creativeEnable && player.theItemInWorldManager.getGameType() == GameType.CREATIVE);
} }

Datei anzeigen

@ -28,7 +28,7 @@ import com.sk89q.worldedit.extension.platform.Preference;
import com.sk89q.worldedit.util.command.CommandMapping; import com.sk89q.worldedit.util.command.CommandMapping;
import com.sk89q.worldedit.util.command.Dispatcher; import com.sk89q.worldedit.util.command.Dispatcher;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.command.ServerCommandManager; import net.minecraft.command.ServerCommandManager;
import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityList;
@ -38,8 +38,10 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.server.management.ServerConfigurationManager; import net.minecraft.server.management.ServerConfigurationManager;
import net.minecraft.world.WorldServer; import net.minecraft.world.WorldServer;
import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.fml.common.FMLCommonHandler;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -121,7 +123,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform {
if (player instanceof ForgePlayer) { if (player instanceof ForgePlayer) {
return player; return player;
} else { } else {
EntityPlayerMP entity = server.getConfigurationManager().func_152612_a(player.getName()); EntityPlayerMP entity = server.getConfigurationManager().getPlayerByUsername(player.getName());
return entity != null ? new ForgePlayer(this, entity) : null; return entity != null ? new ForgePlayer(this, entity) : null;
} }
} }
@ -202,7 +204,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform {
List<Actor> users = new ArrayList<Actor>(); List<Actor> users = new ArrayList<Actor>();
ServerConfigurationManager scm = server.getConfigurationManager(); ServerConfigurationManager scm = server.getConfigurationManager();
for (String name : scm.getAllUsernames()) { for (String name : scm.getAllUsernames()) {
EntityPlayerMP entity = scm.func_152612_a(name); EntityPlayerMP entity = scm.getPlayerByUsername(name);
if (entity != null) { if (entity != null) {
users.add(new ForgePlayer(this, entity)); users.add(new ForgePlayer(this, entity));
} }

Datei anzeigen

@ -33,8 +33,10 @@ import com.sk89q.worldedit.util.Location;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.server.S3FPacketCustomPayload; import net.minecraft.network.play.server.S3FPacketCustomPayload;
import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentText;
import io.netty.buffer.Unpooled;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -64,7 +66,7 @@ public class ForgePlayer extends AbstractPlayerActor {
@Override @Override
public String getName() { public String getName() {
return this.player.getCommandSenderName(); return this.player.getName();
} }
@Override @Override
@ -114,7 +116,8 @@ public class ForgePlayer extends AbstractPlayerActor {
if (params.length > 0) { if (params.length > 0) {
send = send + "|" + StringUtil.joinString(params, "|"); send = send + "|" + StringUtil.joinString(params, "|");
} }
S3FPacketCustomPayload packet = new S3FPacketCustomPayload(ForgeWorldEdit.CUI_PLUGIN_CHANNEL, send.getBytes(WECUIPacketHandler.UTF_8_CHARSET)); PacketBuffer buffer = new PacketBuffer(Unpooled.copiedBuffer(send.getBytes(WECUIPacketHandler.UTF_8_CHARSET)));
S3FPacketCustomPayload packet = new S3FPacketCustomPayload(ForgeWorldEdit.CUI_PLUGIN_CHANNEL, buffer);
this.player.playerNetServerHandler.sendPacket(packet); this.player.playerNetServerHandler.sendPacket(packet);
} }
@ -174,7 +177,7 @@ public class ForgePlayer extends AbstractPlayerActor {
@Override @Override
public SessionKey getSessionKey() { public SessionKey getSessionKey() {
return new SessionKeyImpl(player.getUniqueID(), player.getCommandSenderName()); return new SessionKeyImpl(player.getUniqueID(), player.getName());
} }
private static class SessionKeyImpl implements SessionKey { private static class SessionKeyImpl implements SessionKey {

Datei anzeigen

@ -39,7 +39,9 @@ import com.sk89q.worldedit.util.TreeGenerator.TreeType;
import com.sk89q.worldedit.world.AbstractWorld; import com.sk89q.worldedit.world.AbstractWorld;
import com.sk89q.worldedit.world.biome.BaseBiome; import com.sk89q.worldedit.world.biome.BaseBiome;
import com.sk89q.worldedit.world.registry.WorldData; import com.sk89q.worldedit.world.registry.WorldData;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityList;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
@ -47,6 +49,8 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ClassInheritanceMultiMap;
import net.minecraft.util.LongHashMap; import net.minecraft.util.LongHashMap;
import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -69,6 +73,7 @@ import net.minecraft.world.gen.feature.WorldGenTrees;
import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.feature.WorldGenerator;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
@ -85,6 +90,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
*/ */
public class ForgeWorld extends AbstractWorld { 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 Logger logger = Logger.getLogger(ForgeWorld.class.getCanonicalName());
private static final Random random = new Random(); private static final Random random = new Random();
private final WeakReference<World> worldRef; private final WeakReference<World> worldRef;
@ -154,33 +160,29 @@ public class ForgeWorld extends AbstractWorld {
// First set the block // First set the block
Chunk chunk = world.getChunkFromChunkCoords(x >> 4, z >> 4); Chunk chunk = world.getChunkFromChunkCoords(x >> 4, z >> 4);
int previousId = 0; BlockPos pos = new BlockPos(x, y, z);
IBlockState old = chunk.getBlockState(pos);
if (notifyAndLight) { IBlockState newState = Block.getBlockById(block.getId()).getStateFromMeta(block.getData());
previousId = Block.getIdFromBlock(chunk.getBlock(x & 15, y, z & 15)); IBlockState successState = chunk.setBlockState(pos, newState);
} boolean successful = successState != null;
boolean successful = chunk.func_150807_a(x & 15, y, z & 15, Block.getBlockById(block.getId()), block.getData());
// Create the TileEntity // Create the TileEntity
if (successful) { if (successful) {
CompoundTag tag = block.getNbtData(); if (block.hasNbtData()) {
if (tag != null) { // Kill the old TileEntity
NBTTagCompound nativeTag = NBTConverter.toNative(tag); world.removeTileEntity(pos);
NBTTagCompound nativeTag = NBTConverter.toNative(block.getNbtData());
nativeTag.setString("id", block.getNbtId()); nativeTag.setString("id", block.getNbtId());
TileEntityUtils.setTileEntity(getWorld(), position, nativeTag); TileEntityUtils.setTileEntity(world, position, nativeTag);
} }
} }
if (notifyAndLight) { if (notifyAndLight) {
world.func_147451_t(x, y, z); if (!successful) {
world.markBlockForUpdate(x, y, z); newState = old;
world.notifyBlockChange(x, y, z, Block.getBlockById(previousId));
Block mcBlock = Block.getBlockById(previousId);
if (mcBlock != null && mcBlock.hasComparatorInputOverride()) {
world.func_147453_f(x, y, z, Block.getBlockById(block.getId()));
} }
world.checkLight(pos);
world.markAndNotifyBlock(pos, chunk, old, newState, UPDATE | NOTIFY);
} }
return successful; return successful;
@ -189,13 +191,13 @@ public class ForgeWorld extends AbstractWorld {
@Override @Override
public int getBlockLightLevel(Vector position) { public int getBlockLightLevel(Vector position) {
checkNotNull(position); checkNotNull(position);
return getWorld().getBlockLightValue(position.getBlockX(), position.getBlockY(), position.getBlockZ()); return getWorld().getLight(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()));
} }
@Override @Override
public boolean clearContainerBlockContents(Vector position) { public boolean clearContainerBlockContents(Vector position) {
checkNotNull(position); checkNotNull(position);
TileEntity tile = getWorld().getTileEntity(position.getBlockX(), position.getBlockY(), position.getBlockZ()); TileEntity tile = getWorld().getTileEntity(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()));
if ((tile instanceof IInventory)) { if ((tile instanceof IInventory)) {
IInventory inv = (IInventory) tile; IInventory inv = (IInventory) tile;
int size = inv.getSizeInventory(); int size = inv.getSizeInventory();
@ -210,7 +212,7 @@ public class ForgeWorld extends AbstractWorld {
@Override @Override
public BaseBiome getBiome(Vector2D position) { public BaseBiome getBiome(Vector2D position) {
checkNotNull(position); checkNotNull(position);
return new BaseBiome(getWorld().getBiomeGenForCoords(position.getBlockX(), position.getBlockZ()).biomeID); return new BaseBiome(getWorld().getBiomeGenForCoords(new BlockPos(position.getBlockX(), 0, position.getBlockZ())).biomeID);
} }
@Override @Override
@ -218,8 +220,8 @@ public class ForgeWorld extends AbstractWorld {
checkNotNull(position); checkNotNull(position);
checkNotNull(biome); checkNotNull(biome);
Chunk chunk = getWorld().getChunkFromBlockCoords(position.getBlockX(), position.getBlockZ()); Chunk chunk = getWorld().getChunkFromBlockCoords(new BlockPos(position.getBlockX(), 0, position.getBlockZ()));
if ((chunk != null) && (chunk.isChunkLoaded)) { if ((chunk != null) && (chunk.isLoaded())) {
chunk.getBiomeArray()[((position.getBlockZ() & 0xF) << 4 | position.getBlockX() & 0xF)] = (byte) biome.getId(); chunk.getBiomeArray()[((position.getBlockZ() & 0xF) << 4 | position.getBlockX() & 0xF)] = (byte) biome.getId();
return true; return true;
} }
@ -237,7 +239,7 @@ public class ForgeWorld extends AbstractWorld {
} }
EntityItem entity = new EntityItem(getWorld(), position.getX(), position.getY(), position.getZ(), ForgeWorldEdit.toForgeItemStack(item)); EntityItem entity = new EntityItem(getWorld(), position.getX(), position.getY(), position.getZ(), ForgeWorldEdit.toForgeItemStack(item));
entity.delayBeforeCanPickup = 10; entity.setPickupDelay(10);
getWorld().spawnEntityInWorld(entity); getWorld().spawnEntityInWorld(entity);
} }
@ -384,23 +386,23 @@ public class ForgeWorld extends AbstractWorld {
@Override @Override
public BaseBlock getBlock(Vector position) { public BaseBlock getBlock(Vector position) {
World world = getWorld(); World world = getWorld();
int id = Block.getIdFromBlock(world.getBlock(position.getBlockX(), position.getBlockY(), position.getBlockZ())); BlockPos pos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ());
int data = world.getBlockMetadata(position.getBlockX(), position.getBlockY(), position.getBlockZ()); IBlockState state = world.getBlockState(pos);
TileEntity tile = getWorld().getTileEntity(position.getBlockX(), position.getBlockY(), position.getBlockZ()); TileEntity tile = getWorld().getTileEntity(pos);
if (tile != null) { if (tile != null) {
return new TileEntityBaseBlock(id, data, tile); return new TileEntityBaseBlock(Block.getIdFromBlock(state.getBlock()), state.getBlock().getMetaFromState(state), tile);
} else { } else {
return new BaseBlock(id, data); return new BaseBlock(Block.getIdFromBlock(state.getBlock()), state.getBlock().getMetaFromState(state));
} }
} }
@Override @Override
public BaseBlock getLazyBlock(Vector position) { public BaseBlock getLazyBlock(Vector position) {
World world = getWorld(); World world = getWorld();
int id = Block.getIdFromBlock(world.getBlock(position.getBlockX(), position.getBlockY(), position.getBlockZ())); BlockPos pos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ());
int data = world.getBlockMetadata(position.getBlockX(), position.getBlockY(), position.getBlockZ()); IBlockState state = world.getBlockState(pos);
return new LazyBlock(id, data, this, position); return new LazyBlock(Block.getIdFromBlock(state.getBlock()), state.getBlock().getMetaFromState(state), this, position);
} }
@Override @Override

Datei anzeigen

@ -27,19 +27,7 @@ import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.event.platform.PlatformReadyEvent; import com.sk89q.worldedit.event.platform.PlatformReadyEvent;
import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.internal.LocalWorldAdapter; import com.sk89q.worldedit.internal.LocalWorldAdapter;
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;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent;
import cpw.mods.fml.common.event.FMLServerStartedEvent;
import cpw.mods.fml.common.event.FMLServerStoppingEvent;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -47,6 +35,20 @@ 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.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent;
import net.minecraftforge.fml.common.event.FMLServerStartedEvent;
import net.minecraftforge.fml.common.event.FMLServerStoppingEvent;
import net.minecraftforge.fml.common.eventhandler.Event.Result;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import java.io.File; import java.io.File;
@ -156,7 +158,7 @@ public class ForgeWorldEdit {
Action action = event.action; Action action = event.action;
switch (action) { switch (action) {
case LEFT_CLICK_BLOCK: { case LEFT_CLICK_BLOCK: {
WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), event.x, event.y, event.z); WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), event.pos.getX(), event.pos.getY(), event.pos.getZ());
if (we.handleBlockLeftClick(player, pos)) { if (we.handleBlockLeftClick(player, pos)) {
event.setCanceled(true); event.setCanceled(true);
@ -169,7 +171,7 @@ public class ForgeWorldEdit {
break; break;
} }
case RIGHT_CLICK_BLOCK: { case RIGHT_CLICK_BLOCK: {
WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), event.x, event.y, event.z); WorldVector pos = new WorldVector(LocalWorldAdapter.adapt(world), event.pos.getX(), event.pos.getY(), event.pos.getZ());
if (we.handleBlockRightClick(player, pos)) { if (we.handleBlockRightClick(player, pos)) {
event.setCanceled(true); event.setCanceled(true);

Datei anzeigen

@ -20,11 +20,13 @@
package com.sk89q.worldedit.forge; package com.sk89q.worldedit.forge;
import com.sk89q.worldedit.forge.gui.GuiHandler; import com.sk89q.worldedit.forge.gui.GuiHandler;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.KeyBinding; import net.minecraft.client.settings.KeyBinding;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
public class KeyHandler { public class KeyHandler {

Datei anzeigen

@ -170,7 +170,7 @@ final class NBTConverter {
} }
public static IntArrayTag fromNative(NBTTagIntArray other) { public static IntArrayTag fromNative(NBTTagIntArray other) {
int[] value = other.func_150302_c(); int[] value = other.getIntArray();
return new IntArrayTag(Arrays.copyOf(value, value.length)); return new IntArrayTag(Arrays.copyOf(value, value.length));
} }
@ -192,28 +192,28 @@ final class NBTConverter {
} }
public static LongTag fromNative(NBTTagLong other) { public static LongTag fromNative(NBTTagLong other) {
return new LongTag(other.func_150291_c()); return new LongTag(other.getLong());
} }
public static StringTag fromNative(NBTTagString other) { public static StringTag fromNative(NBTTagString other) {
return new StringTag(other.func_150285_a_()); return new StringTag(other.getString());
} }
public static IntTag fromNative(NBTTagInt other) { public static IntTag fromNative(NBTTagInt other) {
return new IntTag(other.func_150287_d()); return new IntTag(other.getInt());
} }
public static ByteTag fromNative(NBTTagByte other) { public static ByteTag fromNative(NBTTagByte other) {
return new ByteTag(other.func_150290_f()); return new ByteTag(other.getByte());
} }
public static ByteArrayTag fromNative(NBTTagByteArray other) { public static ByteArrayTag fromNative(NBTTagByteArray other) {
byte[] value = other.func_150292_c(); byte[] value = other.getByteArray();
return new ByteArrayTag(Arrays.copyOf(value, value.length)); return new ByteArrayTag(Arrays.copyOf(value, value.length));
} }
public static CompoundTag fromNative(NBTTagCompound other) { public static CompoundTag fromNative(NBTTagCompound other) {
@SuppressWarnings("unchecked") Collection<String> tags = other.func_150296_c(); @SuppressWarnings("unchecked") Set<String> tags = other.getKeySet();
Map<String, Tag> map = new HashMap<String, Tag>(); Map<String, Tag> map = new HashMap<String, Tag>();
for (String tagName : tags) { for (String tagName : tags) {
map.put(tagName, fromNative(other.getTag(tagName))); map.put(tagName, fromNative(other.getTag(tagName)));
@ -222,15 +222,15 @@ final class NBTConverter {
} }
public static FloatTag fromNative(NBTTagFloat other) { public static FloatTag fromNative(NBTTagFloat other) {
return new FloatTag(other.func_150288_h()); return new FloatTag(other.getFloat());
} }
public static ShortTag fromNative(NBTTagShort other) { public static ShortTag fromNative(NBTTagShort other) {
return new ShortTag(other.func_150289_e()); return new ShortTag(other.getShort());
} }
public static DoubleTag fromNative(NBTTagDouble other) { public static DoubleTag fromNative(NBTTagDouble other) {
return new DoubleTag(other.func_150286_g()); return new DoubleTag(other.getDouble());
} }
} }

Datei anzeigen

@ -19,10 +19,11 @@
package com.sk89q.worldedit.forge; package com.sk89q.worldedit.forge;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.MinecraftServer;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
@ -56,7 +57,8 @@ public class ThreadSafeCache {
if (now - lastRefresh > REFRESH_DELAY) { if (now - lastRefresh > REFRESH_DELAY) {
Set<UUID> onlineIds = new HashSet<UUID>(); Set<UUID> onlineIds = new HashSet<UUID>();
if (FMLCommonHandler.instance().getMinecraftServerInstance() == null) { MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
if (server == null || server.getConfigurationManager() == null) {
return; return;
} }
for (Object object : FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList) { for (Object object : FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList) {

Datei anzeigen

@ -20,12 +20,15 @@
package com.sk89q.worldedit.forge; package com.sk89q.worldedit.forge;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagInt; import net.minecraft.nbt.NBTTagInt;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
@ -81,7 +84,7 @@ final class TileEntityUtils {
tileEntity.readFromNBT(tag); tileEntity.readFromNBT(tag);
} }
world.setTileEntity(position.getBlockX(), position.getBlockY(), position.getBlockZ(), tileEntity); world.setTileEntity(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()), tileEntity);
} }
/** /**
@ -97,7 +100,7 @@ final class TileEntityUtils {
updateForSet(tag, position); updateForSet(tag, position);
TileEntity tileEntity = TileEntity.createAndLoadEntity(tag); TileEntity tileEntity = TileEntity.createAndLoadEntity(tag);
if (tileEntity != null) { if (tileEntity != null) {
world.setTileEntity(position.getBlockX(), position.getBlockY(), position.getBlockZ(), tileEntity); world.setTileEntity(new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()), tileEntity);
} }
} }
} }

Datei anzeigen

@ -24,14 +24,13 @@ import java.nio.charset.Charset;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.network.play.client.C17PacketCustomPayload; import net.minecraft.network.play.client.C17PacketCustomPayload;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.network.FMLEventChannel;
import net.minecraftforge.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
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 { public class WECUIPacketHandler {
public static final Charset UTF_8_CHARSET = Charset.forName("UTF-8"); public static final Charset UTF_8_CHARSET = Charset.forName("UTF-8");
private static FMLEventChannel WECUI_CHANNEL; private static FMLEventChannel WECUI_CHANNEL;
@ -52,7 +51,7 @@ public class WECUIPacketHandler {
return; return;
} }
String text = new String(rawPacket.func_149558_e(), UTF_8_CHARSET); String text = new String(rawPacket.getBufferData().array(), UTF_8_CHARSET);
session.handleCUIInitializationMessage(text); session.handleCUIInitializationMessage(text);
} }
} }

Datei anzeigen

@ -19,9 +19,9 @@
package com.sk89q.worldedit.forge.gui; package com.sk89q.worldedit.forge.gui;
import cpw.mods.fml.common.network.IGuiHandler;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;
public class GuiHandler implements IGuiHandler { public class GuiHandler implements IGuiHandler {