package info.u_team.u_team_core.util;

import java.util.Map;
import java.util.concurrent.Callable;
import java.util.function.Supplier;

import com.google.common.collect.Maps;

import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
import net.minecraft.world.item.Item.Properties;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.fml.util.ObfuscationReflectionHelper;

public class ItemProperties extends Properties {

	public ItemProperties() {
	}

	public ItemProperties(Properties properties) {
		maxStackSize = properties.maxStackSize;
		maxDamage = properties.maxDamage;
		craftingRemainingItem = properties.craftingRemainingItem;
		category = properties.category;
		rarity = properties.rarity;
		foodProperties = properties.foodProperties;
		isFireResistant = properties.isFireResistant;
		setValueCanRepair(getValueCanRepair(properties));
		setValueToolClasses(Maps.newHashMap(getValueToolClasses(properties)));
		setValueIster(getValueIster(properties));
	}

	private boolean getValueCanRepair(Properties properties) {
		return ObfuscationReflectionHelper.getPrivateValue(Properties.class, properties, "canRepair");
	}

	private void setValueCanRepair(boolean value) {
		ObfuscationReflectionHelper.setPrivateValue(Properties.class, this, value, "canRepair");
	}

	private Map<ToolType, Integer> getValueToolClasses(Properties properties) {
		return ObfuscationReflectionHelper.getPrivateValue(Properties.class, properties, "toolClasses");
	}

	private void setValueToolClasses(Map<ToolType, Integer> value) {
		ObfuscationReflectionHelper.setPrivateValue(Properties.class, this, value, "toolClasses");
	}

	private Supplier<Callable<BlockEntityWithoutLevelRenderer>> getValueIster(Properties properties) {
		return ObfuscationReflectionHelper.getPrivateValue(Properties.class, properties, "ister");
	}

	private void setValueIster(Supplier<Callable<BlockEntityWithoutLevelRenderer>> value) {
		ObfuscationReflectionHelper.setPrivateValue(Properties.class, this, value, "ister");
	}
}

@@ -58,192 +58,48 @@
 ap;%0A
-import java.util.concurrent.Callable;%0Aimport java.util.function.Supplier;%0A%0Aimport com.google.common.collect.Maps;%0A%0Aimport net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
+%0Aimport com.google.common.collect.Maps;%0A
 %0Aimp
@@ -301,16 +301,17 @@
 rties %7B%0A
+%09
 %0A%09public
@@ -333,16 +333,17 @@
 () %7B%0A%09%7D%0A
+%09
 %0A%09public
@@ -808,55 +808,12 @@
 ));%0A
-%09%09setValueIster(getValueIster(properties));%0A
 %09%7D%0A
+%09
 %0A%09pr
@@ -961,32 +961,33 @@
 canRepair%22);%0A%09%7D%0A
+%09
 %0A%09private void s
@@ -1106,32 +1106,33 @@
 canRepair%22);%0A%09%7D%0A
+%09
 %0A%09private Map%3CTo
@@ -1287,32 +1287,33 @@
 olClasses%22);%0A%09%7D%0A
+%09
 %0A%09private void s
@@ -1462,384 +1462,7 @@
 ;%0A%09%7D
-%0A%0A%09private Supplier%3CCallable%3CBlockEntityWithoutLevelRenderer%3E%3E getValueIster(Properties properties) %7B%0A%09%09return ObfuscationReflectionHelper.getPrivateValue(Properties.class, properties, %22ister%22);%0A%09%7D%0A%0A%09private void setValueIster(Supplier%3CCallable%3CBlockEntityWithoutLevelRenderer%3E%3E value) %7B%0A%09%09ObfuscationReflectionHelper.setPrivateValue(Properties.class, this, value, %22ister%22);%0A%09%7D
 %0A%7D%0A

Remove ister properties