mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 08:17:35 +00:00
Updated raw types in ExtendedBlockState, fixed some ATs, updated some things that needed updating in model classes.
This commit is contained in:
1 parent
d44d82e19d
commit
cff4bf21ae
12 files changed
+46
-59
No files matched your search
@@ -108,12 +108,6 @@ public class BlockStateLoader
|
||||
private final ResourceLocation model;
|
||||
private final ImmutableMap<String, String> customData;
|
||||
|
||||
@Deprecated // remove in 1.9
|
||||
public SubModel(IModelState state, boolean uvLock, ImmutableMap<String, String> textures, ResourceLocation model, ImmutableMap<String, String> customData)
|
||||
{
|
||||
this(state, uvLock, true, true, textures, model, customData);
|
||||
}
|
||||
|
||||
public SubModel(IModelState state, boolean uvLock, boolean smooth, boolean gui3d, ImmutableMap<String, String> textures, ResourceLocation model, ImmutableMap<String, String> customData)
|
||||
{
|
||||
this.state = state;
|
||||
|
||||
@@ -37,7 +37,6 @@ import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class ForgeBlockStateV1 extends Marker
|
||||
{
|
||||
ForgeBlockStateV1.Variant defaults;
|
||||
@@ -372,7 +371,7 @@ public class ForgeBlockStateV1 extends Marker
|
||||
|
||||
protected SubModel asGenericSubModel()
|
||||
{
|
||||
return new SubModel(state.or(TRSRTransformation.identity()), uvLock.or(false), getTextures(), model, getCustomData());
|
||||
return new SubModel(state.or(TRSRTransformation.identity()), smooth.or(true), gui3d.or(true), uvLock.or(false), getTextures(), model, getCustomData());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,6 +9,5 @@ public interface IModelCustomData<M extends IModelCustomData<M>> extends IModel
|
||||
* If unknown data is encountered it should be skipped.
|
||||
* @return a new model, with data applied.
|
||||
*/
|
||||
// 1.9: change IModel to M
|
||||
IModel process(ImmutableMap<String, String> customData);
|
||||
M process(ImmutableMap<String, String> customData);
|
||||
}
|
||||
@@ -21,6 +21,5 @@ public interface IRetexturableModel<M extends IRetexturableModel<M>> extends IMo
|
||||
* @param textures New
|
||||
* @return Model with textures applied.
|
||||
*/
|
||||
// 1.9: change IModel to M
|
||||
IModel retexture(ImmutableMap<String, String> textures);
|
||||
M retexture(ImmutableMap<String, String> textures);
|
||||
}
|
||||
@@ -31,7 +31,6 @@ import com.google.common.collect.ImmutableMap;
|
||||
|
||||
public class ItemLayerModel implements IRetexturableModel<ItemLayerModel>
|
||||
{
|
||||
|
||||
public static final ItemLayerModel instance = new ItemLayerModel(ImmutableList.<ResourceLocation>of());
|
||||
|
||||
private final ImmutableList<ResourceLocation> textures;
|
||||
@@ -71,7 +70,7 @@ public class ItemLayerModel implements IRetexturableModel<ItemLayerModel>
|
||||
return TRSRTransformation.identity();
|
||||
}
|
||||
|
||||
public IModel retexture(ImmutableMap<String, String> textures)
|
||||
public ItemLayerModel retexture(ImmutableMap<String, String> textures)
|
||||
{
|
||||
ImmutableList.Builder<ResourceLocation> builder = ImmutableList.builder();
|
||||
for(int i = 0; i < textures.size() + this.textures.size(); i++)
|
||||
|
||||
@@ -152,7 +152,7 @@ public class ModelDynBucket implements IModel, IModelCustomData<ModelDynBucket>,
|
||||
* If the fluid can't be found, water is used
|
||||
*/
|
||||
@Override
|
||||
public IModel process(ImmutableMap<String, String> customData)
|
||||
public ModelDynBucket process(ImmutableMap<String, String> customData)
|
||||
{
|
||||
String fluidName = customData.get("fluid");
|
||||
Fluid fluid = FluidRegistry.getFluid(fluidName);
|
||||
@@ -183,7 +183,7 @@ public class ModelDynBucket implements IModel, IModelCustomData<ModelDynBucket>,
|
||||
* If no liquid is given a hardcoded variant for the bucket is used.
|
||||
*/
|
||||
@Override
|
||||
public IModel retexture(ImmutableMap<String, String> textures)
|
||||
public ModelDynBucket retexture(ImmutableMap<String, String> textures)
|
||||
{
|
||||
|
||||
ResourceLocation base = baseLocation;
|
||||
|
||||
@@ -391,7 +391,7 @@ public class ModelFluid implements IModelCustomData<ModelFluid>
|
||||
}
|
||||
|
||||
@Override
|
||||
public IModel process(ImmutableMap<String, String> customData)
|
||||
public ModelFluid process(ImmutableMap<String, String> customData)
|
||||
{
|
||||
if(!customData.containsKey("fluid")) return this;
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ public class MultiLayerModel implements IModelCustomData<MultiLayerModel>
|
||||
}
|
||||
|
||||
@Override
|
||||
public IModel process(ImmutableMap<String, String> customData)
|
||||
public MultiLayerModel process(ImmutableMap<String, String> customData)
|
||||
{
|
||||
ImmutableMap.Builder<Optional<BlockRenderLayer>, ModelResourceLocation> builder = ImmutableMap.builder();
|
||||
for(String key : customData.keySet())
|
||||
|
||||
@@ -22,7 +22,7 @@ public class ExtendedBlockState extends BlockStateContainer
|
||||
{
|
||||
private final ImmutableSet<IUnlistedProperty<?>> unlistedProperties;
|
||||
|
||||
public ExtendedBlockState(Block blockIn, @SuppressWarnings("rawtypes") IProperty[] properties, IUnlistedProperty<?>[] unlistedProperties)
|
||||
public ExtendedBlockState(Block blockIn, IProperty<?>[] properties, IUnlistedProperty<?>[] unlistedProperties)
|
||||
{
|
||||
super(blockIn, properties, buildUnlistedMap(unlistedProperties));
|
||||
ImmutableSet.Builder<IUnlistedProperty<?>> builder = ImmutableSet.<IUnlistedProperty<?>>builder();
|
||||
@@ -49,7 +49,7 @@ public class ExtendedBlockState extends BlockStateContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
protected StateImplementation createState(Block block, @SuppressWarnings("rawtypes") ImmutableMap<IProperty, Comparable> properties, ImmutableMap<IUnlistedProperty<?>, Optional<?>> unlistedProperties)
|
||||
protected StateImplementation createState(Block block, ImmutableMap<IProperty<?>, Comparable<?>> properties, ImmutableMap<IUnlistedProperty<?>, Optional<?>> unlistedProperties)
|
||||
{
|
||||
if (unlistedProperties == null || unlistedProperties.isEmpty()) return super.createState(block, properties, unlistedProperties);
|
||||
return new ExtendedStateImplementation(block, properties, unlistedProperties, null);
|
||||
@@ -58,10 +58,9 @@ public class ExtendedBlockState extends BlockStateContainer
|
||||
protected static class ExtendedStateImplementation extends StateImplementation implements IExtendedBlockState
|
||||
{
|
||||
private final ImmutableMap<IUnlistedProperty<?>, Optional<?>> unlistedProperties;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private Map<Map<IProperty, Comparable>, BlockState.StateImplementation> normalMap;
|
||||
private Map<Map<IProperty<?>, Comparable<?>>, BlockStateContainer.StateImplementation> normalMap;
|
||||
|
||||
protected ExtendedStateImplementation(Block block, @SuppressWarnings("rawtypes") ImmutableMap<IProperty, Comparable> properties, ImmutableMap<IUnlistedProperty<?>, Optional<?>> unlistedProperties, @SuppressWarnings("rawtypes") 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;
|
||||
@@ -85,15 +84,13 @@ public class ExtendedBlockState extends BlockStateContainer
|
||||
{
|
||||
return this;
|
||||
}
|
||||
@SuppressWarnings("rawtypes")
|
||||
Map<IProperty, Comparable> map = Maps.newHashMap(getProperties());
|
||||
Map<IProperty<?>, Comparable<?>> map = Maps.newHashMap(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);
|
||||
}
|
||||
@SuppressWarnings("rawtypes")
|
||||
ImmutableTable<IProperty, Comparable, IBlockState> table = propertyValueTable;
|
||||
ImmutableTable<IProperty<?>, Comparable<?>, IBlockState> table = propertyValueTable;
|
||||
table = ((StateImplementation)table.get(property, value)).getPropertyValueTable();
|
||||
return new ExtendedStateImplementation(getBlock(), ImmutableMap.copyOf(map), unlistedProperties, table).setMap(this.normalMap);
|
||||
}
|
||||
@@ -138,13 +135,13 @@ public class ExtendedBlockState extends BlockStateContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildPropertyValueTable(@SuppressWarnings("rawtypes") Map<Map<IProperty, Comparable>, BlockState.StateImplementation> map)
|
||||
public void buildPropertyValueTable(Map<Map<IProperty<?>, Comparable<?>>, BlockStateContainer.StateImplementation> map)
|
||||
{
|
||||
this.normalMap = map;
|
||||
super.buildPropertyValueTable(map);
|
||||
}
|
||||
|
||||
private ExtendedStateImplementation setMap(@SuppressWarnings("rawtypes") Map<Map<IProperty, Comparable>, BlockState.StateImplementation> map)
|
||||
private ExtendedStateImplementation setMap(Map<Map<IProperty<?>, Comparable<?>>, BlockStateContainer.StateImplementation> map)
|
||||
{
|
||||
this.normalMap = map;
|
||||
return this;
|
||||
|
||||
Reference in new issue
Block a user