Fixed test cases for 1.11 changes.
This commit is contained in:
parent
c459b87ec9
commit
648067efc2
4 changed files with 34 additions and 8 deletions
|
@ -0,0 +1,17 @@
|
||||||
|
--- ../src-base/minecraft/net/minecraft/enchantment/EnumEnchantmentType.java
|
||||||
|
+++ ../src-work/minecraft/net/minecraft/enchantment/EnumEnchantmentType.java
|
||||||
|
@@ -100,5 +100,13 @@
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- public abstract boolean func_77557_a(Item p_77557_1_);
|
||||||
|
+ private com.google.common.base.Predicate<Item> delegate = null;
|
||||||
|
+ private EnumEnchantmentType(com.google.common.base.Predicate<Item> delegate)
|
||||||
|
+ {
|
||||||
|
+ this.delegate = delegate;
|
||||||
|
+ }
|
||||||
|
+ public boolean func_77557_a(Item p_77557_1_)
|
||||||
|
+ {
|
||||||
|
+ return this.delegate == null ? false : this.delegate.apply(p_77557_1_);
|
||||||
|
+ }
|
||||||
|
}
|
|
@ -22,6 +22,7 @@ package net.minecraftforge.common.util;
|
||||||
import java.lang.reflect.*;
|
import java.lang.reflect.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import net.minecraftforge.fml.common.EnhancedRuntimeException;
|
import net.minecraftforge.fml.common.EnhancedRuntimeException;
|
||||||
|
@ -35,6 +36,7 @@ import net.minecraft.entity.item.EntityPainting.EnumArt;
|
||||||
import net.minecraft.entity.player.EntityPlayer.SleepResult;
|
import net.minecraft.entity.player.EntityPlayer.SleepResult;
|
||||||
import net.minecraft.item.EnumAction;
|
import net.minecraft.item.EnumAction;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.Item.ToolMaterial;
|
import net.minecraft.item.Item.ToolMaterial;
|
||||||
import net.minecraft.item.ItemArmor.ArmorMaterial;
|
import net.minecraft.item.ItemArmor.ArmorMaterial;
|
||||||
import net.minecraft.util.SoundEvent;
|
import net.minecraft.util.SoundEvent;
|
||||||
|
@ -62,7 +64,7 @@ public class EnumHelper
|
||||||
{EnumCreatureAttribute.class},
|
{EnumCreatureAttribute.class},
|
||||||
{EnumCreatureType.class, Class.class, int.class, Material.class, boolean.class, boolean.class},
|
{EnumCreatureType.class, Class.class, int.class, Material.class, boolean.class, boolean.class},
|
||||||
{Door.class},
|
{Door.class},
|
||||||
{EnumEnchantmentType.class},
|
{EnumEnchantmentType.class, Predicate.class},
|
||||||
{Sensitivity.class},
|
{Sensitivity.class},
|
||||||
{RayTraceResult.Type.class},
|
{RayTraceResult.Type.class},
|
||||||
{EnumSkyBlock.class, int.class},
|
{EnumSkyBlock.class, int.class},
|
||||||
|
@ -95,9 +97,9 @@ public class EnumHelper
|
||||||
{
|
{
|
||||||
return addEnum(Door.class, name);
|
return addEnum(Door.class, name);
|
||||||
}
|
}
|
||||||
public static EnumEnchantmentType addEnchantmentType(String name)
|
public static EnumEnchantmentType addEnchantmentType(String name, Predicate<Item> delegate)
|
||||||
{
|
{
|
||||||
return addEnum(EnumEnchantmentType.class, name);
|
return addEnum(EnumEnchantmentType.class, name, delegate);
|
||||||
}
|
}
|
||||||
public static Sensitivity addSensitivity(String name)
|
public static Sensitivity addSensitivity(String name)
|
||||||
{
|
{
|
||||||
|
@ -372,4 +374,4 @@ public class EnumHelper
|
||||||
setup();
|
setup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,10 +31,10 @@ public class VanillaRegistryTests
|
||||||
public void testSetup()
|
public void testSetup()
|
||||||
{
|
{
|
||||||
// All the blocks loaded
|
// All the blocks loaded
|
||||||
assertEquals("We have all the blocks via GameData",219,Block.REGISTRY.getKeys().size());
|
assertEquals("We have all the blocks via GameData",236,Block.REGISTRY.getKeys().size());
|
||||||
|
|
||||||
// All the items loaded
|
// All the items loaded
|
||||||
assertEquals("We have all the items via GameData",371,Item.REGISTRY.getKeys().size());
|
assertEquals("We have all the items via GameData",391,Item.REGISTRY.getKeys().size());
|
||||||
|
|
||||||
// Our lookups find the same stuff vanilla sees
|
// Our lookups find the same stuff vanilla sees
|
||||||
final IForgeRegistry<Block> blocks = PersistentRegistryManager.findRegistry(Blocks.AIR);
|
final IForgeRegistry<Block> blocks = PersistentRegistryManager.findRegistry(Blocks.AIR);
|
||||||
|
|
|
@ -10,6 +10,7 @@ import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import net.minecraft.enchantment.EnumEnchantmentType;
|
||||||
import net.minecraft.init.Bootstrap;
|
import net.minecraft.init.Bootstrap;
|
||||||
import net.minecraftforge.client.EnumHelperClient;
|
import net.minecraftforge.client.EnumHelperClient;
|
||||||
import net.minecraftforge.common.BiomeDictionary;
|
import net.minecraftforge.common.BiomeDictionary;
|
||||||
|
@ -85,7 +86,13 @@ public class EnumHelperTest
|
||||||
|
|
||||||
for (Constructor<?> declaredConstructor : declaredConstructors)
|
for (Constructor<?> declaredConstructor : declaredConstructors)
|
||||||
{
|
{
|
||||||
seenCtrs.add(declaredConstructor);
|
boolean filter = declaredConstructor.isSynthetic();
|
||||||
|
|
||||||
|
if (returnType == EnumEnchantmentType.class && declaredConstructor.getParameterTypes().length == 2)
|
||||||
|
filter = true; //We don't want people using this method.
|
||||||
|
|
||||||
|
if (!filter)
|
||||||
|
seenCtrs.add(declaredConstructor);
|
||||||
//System.out.println(" " + declaredConstructor.toString());
|
//System.out.println(" " + declaredConstructor.toString());
|
||||||
|
|
||||||
Class<?>[] expectedParameters = declaredConstructor.getParameterTypes();
|
Class<?>[] expectedParameters = declaredConstructor.getParameterTypes();
|
||||||
|
@ -141,4 +148,4 @@ public class EnumHelperTest
|
||||||
// This works, it's been tested, find a way to make this a unit test...
|
// This works, it's been tested, find a way to make this a unit test...
|
||||||
//Assert.assertEquals(BiomeDictionary.Type.getType("NEWTYPE"), BiomeDictionary.Type.getType("NEWTYPE"));
|
//Assert.assertEquals(BiomeDictionary.Type.getType("NEWTYPE"), BiomeDictionary.Type.getType("NEWTYPE"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue