mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 16:27:47 +00:00
Fixed a bug with ExtendedBlockStates containing at least one IProperty and one IUnlistedProperty not allowing blocks to be placed.
This commit is contained in:
1 parent
5eea9cebae
commit
87bbbfafcc
7 files changed
+122
-35
No files matched your search
@@ -47,6 +47,7 @@ public class ExtendedBlockState extends BlockState
|
||||
@Override
|
||||
protected StateImplementation createState(Block block, ImmutableMap properties, ImmutableMap unlistedProperties)
|
||||
{
|
||||
if (unlistedProperties == null || unlistedProperties.isEmpty()) return super.createState(block, properties, unlistedProperties);
|
||||
return new ExtendedStateImplementation(block, properties, unlistedProperties, null);
|
||||
}
|
||||
|
||||
@@ -79,15 +80,15 @@ public class ExtendedBlockState extends BlockState
|
||||
{
|
||||
return this;
|
||||
}
|
||||
if(Iterables.all(unlistedProperties.values(), Predicates.<Optional<?>>equalTo(Optional.absent())))
|
||||
{ // no dynamic properties present, looking up in the normal table
|
||||
return super.withProperty(property, value);
|
||||
}
|
||||
Map<IProperty, Comparable> map = new HashMap<IProperty, Comparable>(getProperties());
|
||||
map.put(property, value);
|
||||
if(Iterables.all(unlistedProperties.values(), Predicates.<Optional<?>>equalTo(Optional.absent())))
|
||||
{ // no dynamic properties present, looking up in the normal table
|
||||
return (IExtendedBlockState) normalMap.get(map);
|
||||
}
|
||||
ImmutableTable<IProperty, Comparable, IBlockState> table = propertyValueTable;
|
||||
table = ((StateImplementation)table.get(property, value)).getPropertyValueTable();
|
||||
return new ExtendedStateImplementation(getBlock(), ImmutableMap.copyOf(map), unlistedProperties, table);
|
||||
return new ExtendedStateImplementation(getBlock(), ImmutableMap.copyOf(map), unlistedProperties, table).setMap(this.normalMap);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +108,7 @@ public class ExtendedBlockState extends BlockState
|
||||
{ // no dynamic properties, lookup normal state
|
||||
return (IExtendedBlockState) normalMap.get(getProperties());
|
||||
}
|
||||
return new ExtendedStateImplementation(getBlock(), getProperties(), ImmutableMap.copyOf(newMap), propertyValueTable);
|
||||
return new ExtendedStateImplementation(getBlock(), getProperties(), ImmutableMap.copyOf(newMap), propertyValueTable).setMap(this.normalMap);
|
||||
}
|
||||
|
||||
public Collection<IUnlistedProperty<?>> getUnlistedNames()
|
||||
@@ -135,5 +136,16 @@ public class ExtendedBlockState extends BlockState
|
||||
this.normalMap = map;
|
||||
super.buildPropertyValueTable(map);
|
||||
}
|
||||
|
||||
private ExtendedStateImplementation setMap(Map<Map<IProperty, Comparable>, IBlockState> map)
|
||||
{
|
||||
this.normalMap = map;
|
||||
return this;
|
||||
}
|
||||
|
||||
public IBlockState getClean()
|
||||
{
|
||||
return this.normalMap.get(getProperties());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,4 +16,6 @@ public interface IExtendedBlockState extends IBlockState
|
||||
<V>IExtendedBlockState withProperty(IUnlistedProperty<V> property, V value);
|
||||
|
||||
ImmutableMap<IUnlistedProperty<?>, Optional<?>> getUnlistedProperties();
|
||||
|
||||
IBlockState getClean();
|
||||
}
|
||||
Reference in new issue
Block a user