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); + 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); + 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; this.block = blockIn;
Arrays.sort(properties, new Comparator<IProperty>() Arrays.sort(properties, new Comparator<IProperty>()
@ -22,7 +22,7 @@
{ {
Map<IProperty, Comparable> map1 = MapPopulator.<IProperty, Comparable>createMap(this.properties, list1); 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 = 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); map.put(map1, blockstate$stateimplementation);
list.add(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.block = blockIn;
+ this.properties = propertiesIn; + this.properties = propertiesIn;

View file

@ -56,7 +56,7 @@ public class ExtendedBlockState extends BlockState
private final ImmutableMap<IUnlistedProperty<?>, Optional<?>> unlistedProperties; private final ImmutableMap<IUnlistedProperty<?>, Optional<?>> unlistedProperties;
private Map<Map<IProperty, Comparable>, IBlockState> normalMap; 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); super(block, properties);
this.unlistedProperties = unlistedProperties; this.unlistedProperties = unlistedProperties;
@ -64,7 +64,7 @@ public class ExtendedBlockState extends BlockState
} }
@Override @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)) if (!this.getProperties().containsKey(property))
{ {