/*
 * This file is part of PhantomPackets for Bukkit, licensed under the MIT License (MIT).
 *
 * Copyright (c) JCThePants (www.jcwhatever.com)
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package com.jcwhatever.bukkit.phantom.nms.v1_8_R2;

import com.jcwhatever.nucleus.utils.reflection.ReflectedInstance;
import com.jcwhatever.nucleus.utils.reflection.ReflectedType;
import com.jcwhatever.nucleus.utils.reflection.Reflection;

import net.minecraft.server.v1_8_R2.IBlockData;
import net.minecraft.server.v1_8_R2.PacketPlayOutMultiBlockChange;
import net.minecraft.server.v1_8_R2.PacketPlayOutMultiBlockChange.MultiBlockChangeInfo;

public class MultiBlockChangeInfoUtil {

    static final Reflection reflection = new Reflection("v1_8_R2");

    static final ReflectedType _MultiBlockChangeInfo =
            reflection.nmsType("PacketPlayOutMultiBlockChange$MultiBlockChangeInfo")
                    .constructorAlias("new",
                            PacketPlayOutMultiBlockChange.class,
                            short.class, IBlockData.class)
                    .fieldAlias("position", "b")
                    .fieldAlias("data", "c");


    static void modify(MultiBlockChangeInfo info, short position, IBlockData data) {

        ReflectedInstance instance = _MultiBlockChangeInfo.reflect(info);

        instance.set("position", position);
        instance.set("data", data);
    }

    static MultiBlockChangeInfo create(PacketPlayOutMultiBlockChange packet, short position, IBlockData data) {
        return (MultiBlockChangeInfo)_MultiBlockChangeInfo.construct("new", packet, position, data);
    }

}

@@ -1291,37 +1291,39 @@
 hatever.nucleus.
-utils
+managed
 .reflection.Refl
@@ -1310,32 +1310,33 @@
 aged.reflection.
+I
 ReflectedInstanc
@@ -1360,37 +1360,39 @@
 hatever.nucleus.
-utils
+managed
 .reflection.Refl
@@ -1383,24 +1383,25 @@
 .reflection.
+I
 ReflectedTyp
@@ -1437,13 +1437,77 @@
 eus.
-utils
+managed.reflection.IReflection;%0Aimport com.jcwhatever.nucleus.managed
 .ref
@@ -1785,24 +1785,25 @@
 tatic final 
+I
 Reflection r
@@ -1817,12 +1817,8 @@
 on =
- new
  Ref
@@ -1828,18 +1828,20 @@
 tion
-(%22v1_8_R2%22
+.newContext(
 );%0A%0A
@@ -1857,16 +1857,17 @@
 c final 
+I
 Reflecte
@@ -2341,16 +2341,17 @@
         
+I
 Reflecte

move reflection implementation to "internal"