diff --git a/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java b/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java index a0b5a318f8..7711273e8e 100644 --- a/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java +++ b/src/main/java/net/minecraftforge/common/property/ExtendedBlockState.java @@ -8,22 +8,21 @@ import java.util.Map; import net.minecraft.block.Block; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.BlockState; -import net.minecraft.block.state.BlockState.StateImplementation; import net.minecraft.block.state.IBlockState; import com.google.common.base.Optional; import com.google.common.base.Predicates; -import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableTable; import com.google.common.collect.Iterables; +import com.google.common.collect.Maps; public class ExtendedBlockState extends BlockState { private final ImmutableSet> unlistedProperties; - public ExtendedBlockState(Block blockIn, IProperty[] properties, IUnlistedProperty[] unlistedProperties) + public ExtendedBlockState(Block blockIn, @SuppressWarnings("rawtypes") IProperty[] properties, IUnlistedProperty[] unlistedProperties) { super(blockIn, properties, buildUnlistedMap(unlistedProperties)); ImmutableSet.Builder> builder = ImmutableSet.>builder(); @@ -45,7 +44,7 @@ public class ExtendedBlockState extends BlockState } @Override - protected StateImplementation createState(Block block, ImmutableMap properties, ImmutableMap unlistedProperties) + protected StateImplementation createState(Block block, @SuppressWarnings("rawtypes") ImmutableMap properties, ImmutableMap, Optional> unlistedProperties) { if (unlistedProperties == null || unlistedProperties.isEmpty()) return super.createState(block, properties, unlistedProperties); return new ExtendedStateImplementation(block, properties, unlistedProperties, null); @@ -54,9 +53,10 @@ public class ExtendedBlockState extends BlockState protected static class ExtendedStateImplementation extends StateImplementation implements IExtendedBlockState { private final ImmutableMap, Optional> unlistedProperties; - private Map, IBlockState> normalMap; + @SuppressWarnings("rawtypes") + private Map, BlockState.StateImplementation> normalMap; - protected ExtendedStateImplementation(Block block, ImmutableMap properties, ImmutableMap, Optional> unlistedProperties, ImmutableTable table) + protected ExtendedStateImplementation(Block block, @SuppressWarnings("rawtypes") ImmutableMap properties, ImmutableMap, Optional> unlistedProperties, @SuppressWarnings("rawtypes") ImmutableTable table) { super(block, properties); this.unlistedProperties = unlistedProperties; @@ -80,12 +80,14 @@ public class ExtendedBlockState extends BlockState { return this; } - Map map = new HashMap(getProperties()); + @SuppressWarnings("rawtypes") + Map map = Maps.newHashMap(getProperties()); map.put(property, value); if(Iterables.all(unlistedProperties.values(), Predicates.>equalTo(Optional.absent()))) { // no dynamic properties present, looking up in the normal table return (IExtendedBlockState) normalMap.get(map); } + @SuppressWarnings("rawtypes") ImmutableTable table = propertyValueTable; table = ((StateImplementation)table.get(property, value)).getPropertyValueTable(); return new ExtendedStateImplementation(getBlock(), ImmutableMap.copyOf(map), unlistedProperties, table).setMap(this.normalMap); @@ -131,13 +133,13 @@ public class ExtendedBlockState extends BlockState } @Override - public void buildPropertyValueTable(Map map) + public void buildPropertyValueTable(@SuppressWarnings("rawtypes") Map, BlockState.StateImplementation> map) { this.normalMap = map; super.buildPropertyValueTable(map); } - private ExtendedStateImplementation setMap(Map, IBlockState> map) + private ExtendedStateImplementation setMap(@SuppressWarnings("rawtypes") Map, BlockState.StateImplementation> map) { this.normalMap = map; return this; diff --git a/src/main/java/net/minecraftforge/common/property/Properties.java b/src/main/java/net/minecraftforge/common/property/Properties.java index b24e6beea0..5063da2735 100644 --- a/src/main/java/net/minecraftforge/common/property/Properties.java +++ b/src/main/java/net/minecraftforge/common/property/Properties.java @@ -1,23 +1,19 @@ package net.minecraftforge.common.property; -import java.lang.reflect.InvocationTargetException; - import net.minecraft.block.properties.IProperty; -import org.apache.commons.lang3.reflect.ConstructorUtils; - public class Properties { - public static

IUnlistedProperty toUnlisted(P property) + public static > IUnlistedProperty toUnlisted(IProperty property) { - return new PropertyAdapter(property); + return new PropertyAdapter(property); } - public static class PropertyAdapter implements IUnlistedProperty + public static class PropertyAdapter> implements IUnlistedProperty { - private final IProperty parent; + private final IProperty parent; - public PropertyAdapter(IProperty parent) + public PropertyAdapter(IProperty parent) { this.parent = parent; }