Fix generics and error in the BlockState patch.

This commit is contained in:
RainWarrior 2015-11-10 00:42:56 +03:00
parent e833ee81fb
commit f20b40fb80
2 changed files with 6 additions and 6 deletions

View File

@ -7,12 +7,12 @@
+ this(blockIn, properties, null);
+ }
+
+ protected StateImplementation createState(Block block, ImmutableMap properties, ImmutableMap unlistedProperties)
+ protected StateImplementation createState(Block block, ImmutableMap<IProperty, Comparable> properties, ImmutableMap<net.minecraftforge.common.property.IUnlistedProperty<?>, com.google.common.base.Optional<?>> unlistedProperties)
+ {
+ return new StateImplementation(block, properties);
+ }
+
+ protected BlockState(Block blockIn, IProperty[] properties, ImmutableMap unlistedProperties)
+ protected BlockState(Block blockIn, IProperty[] properties, ImmutableMap<net.minecraftforge.common.property.IUnlistedProperty<?>, com.google.common.base.Optional<?>> unlistedProperties)
+ {
this.block = blockIn;
Arrays.sort(properties, new Comparator<IProperty>()
@ -22,7 +22,7 @@
{
Map<IProperty, Comparable> map1 = MapPopulator.<IProperty, Comparable>createMap(this.properties, list1);
- BlockState.StateImplementation blockstate$stateimplementation = new BlockState.StateImplementation(blockIn, ImmutableMap.copyOf(map1));
+ BlockState.StateImplementation blockstate$stateimplementation = createState(blockIn, ImmutableMap.copyOf(map), unlistedProperties);
+ BlockState.StateImplementation blockstate$stateimplementation = createState(blockIn, ImmutableMap.copyOf(map1), unlistedProperties);
map.put(map1, blockstate$stateimplementation);
list.add(blockstate$stateimplementation);
}
@ -30,7 +30,7 @@
}
}
+ protected StateImplementation(Block blockIn, ImmutableMap propertiesIn, ImmutableTable propertyValueTable)
+ protected StateImplementation(Block blockIn, ImmutableMap<IProperty, Comparable> propertiesIn, ImmutableTable<IProperty, Comparable, IBlockState> propertyValueTable)
+ {
+ this.block = blockIn;
+ this.properties = propertiesIn;

View File

@ -56,7 +56,7 @@ public class ExtendedBlockState extends BlockState
private final ImmutableMap<IUnlistedProperty<?>, Optional<?>> unlistedProperties;
private Map<Map<IProperty, Comparable>, IBlockState> normalMap;
protected ExtendedStateImplementation(Block block, ImmutableMap properties, ImmutableMap<IUnlistedProperty<?>, Optional<?>> unlistedProperties, ImmutableTable<IProperty, Comparable, IBlockState> table)
protected ExtendedStateImplementation(Block block, ImmutableMap<IProperty, Comparable> properties, ImmutableMap<IUnlistedProperty<?>, Optional<?>> unlistedProperties, ImmutableTable<IProperty, Comparable, IBlockState> table)
{
super(block, properties);
this.unlistedProperties = unlistedProperties;
@ -64,7 +64,7 @@ public class ExtendedBlockState extends BlockState
}
@Override
public IBlockState withProperty(IProperty property, Comparable value)
public <T extends Comparable<T>, V extends T> IBlockState withProperty(IProperty<T> property, V value)
{
if (!this.getProperties().containsKey(property))
{