Updated raw types in ExtendedBlockState, fixed some ATs, updated some things that needed updating in model classes.

This commit is contained in:
RainWarrior 2016-03-02 20:00:32 +03:00
parent d44d82e19d
commit cff4bf21ae
12 changed files with 46 additions and 59 deletions

View File

@ -12,7 +12,7 @@
+ return new StateImplementation(block, properties);
+ }
+
+ protected BlockStateContainer(Block blockIn, IProperty[] properties, ImmutableMap<net.minecraftforge.common.property.IUnlistedProperty<?>, com.google.common.base.Optional<?>> unlistedProperties)
+ protected BlockStateContainer(Block blockIn, IProperty<?>[] properties, ImmutableMap<net.minecraftforge.common.property.IUnlistedProperty<?>, com.google.common.base.Optional<?>> unlistedProperties)
+ {
this.block = blockIn;
Map < String, IProperty<? >> map = Maps. < String, IProperty<? >> newHashMap();

View File

@ -11,7 +11,7 @@
}
@@ -370,6 +370,7 @@
private void registerVariantNames()
protected void registerVariantNames()
{
+ this.variantNames.clear(); //FML clear this to prevent double ups.
this.variantNames.put(Item.getItemFromBlock(Blocks.stone), Lists.newArrayList(new String[] {"stone", "granite", "granite_smooth", "diorite", "diorite_smooth", "andesite", "andesite_smooth"}));
@ -27,10 +27,10 @@
+ }
}
private List<String> getVariantNames(Item p_177596_1_)
protected List<String> getVariantNames(Item p_177596_1_)
@@ -429,7 +434,7 @@
private ResourceLocation getItemLocation(String p_177583_1_)
protected ResourceLocation getItemLocation(String p_177583_1_)
{
- ResourceLocation resourcelocation = new ResourceLocation(p_177583_1_);
+ ResourceLocation resourcelocation = new ResourceLocation(p_177583_1_.replaceAll("#.*", ""));

View File

@ -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;

View File

@ -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());
}
/**

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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++)

View File

@ -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;

View File

@ -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;

View File

@ -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())

View File

@ -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;

View File

@ -109,35 +109,35 @@ public net.minecraft.world.gen.ChunkProviderServer field_73251_h # worldObj
protected net.minecraft.client.renderer.entity.RenderEntityItem func_177078_a(Lnet/minecraft/item/ItemStack;)I # getMiniItemCount
public net.minecraft.item.crafting.RecipesBanners$RecipeAddPattern
public net.minecraft.item.crafting.RecipesBanners$RecipeDuplicatePattern
#public net.minecraft.block.state.BlockState$StateImplementation
#protected net.minecraft.block.state.BlockState$StateImplementation <init>(Lnet/minecraft/block/Block;Lcom/google/common/collect/ImmutableMap;)V
#protected net.minecraft.block.state.BlockState$StateImplementation field_177238_c # propertyValueTable
public net.minecraft.block.state.BlockStateContainer$StateImplementation
protected net.minecraft.block.state.BlockStateContainer$StateImplementation <init>(Lnet/minecraft/block/Block;Lcom/google/common/collect/ImmutableMap;)V
protected net.minecraft.block.state.BlockStateContainer$StateImplementation field_177238_c # propertyValueTable
public net.minecraft.client.renderer.block.model.ModelBlock field_178318_c # textures
public net.minecraft.client.renderer.block.model.ModelBlock field_178315_d # parent
public net.minecraft.client.renderer.block.model.ModelBlock field_178322_i # ambientOcclusion
#protected net.minecraft.client.resources.model.ModelBakery field_177602_b # LOCATIONS_BUILTIN_TEXTURES
#protected net.minecraft.client.resources.model.ModelBakery field_177598_f # resourceManager
#protected net.minecraft.client.resources.model.ModelBakery field_177599_g # sprites
#protected net.minecraft.client.resources.model.ModelBakery field_177609_j # textureMap
#protected net.minecraft.client.resources.model.ModelBakery field_177610_k # blockModelShapes
#protected net.minecraft.client.resources.model.ModelBakery field_177605_n # bakedRegistry
#protected net.minecraft.client.resources.model.ModelBakery field_177606_o # MODEL_GENERATED
#protected net.minecraft.client.resources.model.ModelBakery field_177618_p # MODEL_COMPASS
#protected net.minecraft.client.resources.model.ModelBakery field_177617_q # MODEL_CLOCK
#protected net.minecraft.client.resources.model.ModelBakery field_177616_r # MODEL_ENTITY
#protected net.minecraft.client.resources.model.ModelBakery func_177591_a(Ljava/util/Collection;)V # loadVariants
#protected net.minecraft.client.resources.model.ModelBakery func_177569_a(Lnet/minecraft/client/renderer/block/model/ModelBlockDefinition;Lnet/minecraft/client/resources/model/ModelResourceLocation;)V # registerVariant
#protected net.minecraft.client.resources.model.ModelBakery func_177586_a(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/block/model/ModelBlockDefinition; # getModelBlockDefinition
#protected net.minecraft.client.resources.model.ModelBakery func_177594_c(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/block/model/ModelBlock; # loadModel
#protected net.minecraft.client.resources.model.ModelBakery func_177592_e()V # registerVariantNames
#protected net.minecraft.client.resources.model.ModelBakery func_177596_a(Lnet/minecraft/item/Item;)Ljava/util/List; # getVariantNames
#protected net.minecraft.client.resources.model.ModelBakery func_177583_a(Ljava/lang/String;)Lnet/minecraft/util/ResourceLocation; # getItemLocation
#protected net.minecraft.client.resources.model.ModelBakery func_177585_a(Lnet/minecraft/client/renderer/block/model/ModelBlock;)Ljava/util/Set; # getTextureLocations
#protected net.minecraft.client.resources.model.ModelBakery func_177581_b(Lnet/minecraft/client/renderer/block/model/ModelBlock;)Z # hasItemModel
#protected net.minecraft.client.resources.model.ModelBakery func_177587_c(Lnet/minecraft/client/renderer/block/model/ModelBlock;)Z # isCustomRenderer
#protected net.minecraft.client.resources.model.ModelBakery func_177582_d(Lnet/minecraft/client/renderer/block/model/ModelBlock;)Lnet/minecraft/client/renderer/block/model/ModelBlock; # makeItemModel
#protected net.minecraft.client.resources.model.ModelBakery func_177580_d(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/util/ResourceLocation; # getModelLocation
#public net.minecraft.client.resources.model.WeightedBakedModel field_177565_b # models
protected net.minecraft.client.renderer.block.model.ModelBakery field_177602_b # LOCATIONS_BUILTIN_TEXTURES
protected net.minecraft.client.renderer.block.model.ModelBakery field_177598_f # resourceManager
protected net.minecraft.client.renderer.block.model.ModelBakery field_177599_g # sprites
protected net.minecraft.client.renderer.block.model.ModelBakery field_177609_j # textureMap
protected net.minecraft.client.renderer.block.model.ModelBakery field_177610_k # blockModelShapes
protected net.minecraft.client.renderer.block.model.ModelBakery field_177605_n # bakedRegistry
protected net.minecraft.client.renderer.block.model.ModelBakery field_177606_o # MODEL_GENERATED
#protected net.minecraft.client.renderer.block.model.ModelBakery field_177618_p # MODEL_COMPASS
#protected net.minecraft.client.renderer.block.model.ModelBakery field_177617_q # MODEL_CLOCK
protected net.minecraft.client.renderer.block.model.ModelBakery field_177616_r # MODEL_ENTITY
#protected net.minecraft.client.renderer.block.model.ModelBakery func_177591_a(Ljava/util/Collection;)V # loadVariants
protected net.minecraft.client.renderer.block.model.ModelBakery func_177569_a(Lnet/minecraft/client/renderer/block/model/ModelBlockDefinition;Lnet/minecraft/client/renderer/block/model/ModelResourceLocation;)V # registerVariant
protected net.minecraft.client.renderer.block.model.ModelBakery func_177586_a(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/block/model/ModelBlockDefinition; # getModelBlockDefinition
protected net.minecraft.client.renderer.block.model.ModelBakery func_177594_c(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/block/model/ModelBlock; # loadModel
protected net.minecraft.client.renderer.block.model.ModelBakery func_177592_e()V # registerVariantNames
protected net.minecraft.client.renderer.block.model.ModelBakery func_177596_a(Lnet/minecraft/item/Item;)Ljava/util/List; # getVariantNames
protected net.minecraft.client.renderer.block.model.ModelBakery func_177583_a(Ljava/lang/String;)Lnet/minecraft/util/ResourceLocation; # getItemLocation
protected net.minecraft.client.renderer.block.model.ModelBakery func_177585_a(Lnet/minecraft/client/renderer/block/model/ModelBlock;)Ljava/util/Set; # getTextureLocations
protected net.minecraft.client.renderer.block.model.ModelBakery func_177581_b(Lnet/minecraft/client/renderer/block/model/ModelBlock;)Z # hasItemModel
protected net.minecraft.client.renderer.block.model.ModelBakery func_177587_c(Lnet/minecraft/client/renderer/block/model/ModelBlock;)Z # isCustomRenderer
protected net.minecraft.client.renderer.block.model.ModelBakery func_177582_d(Lnet/minecraft/client/renderer/block/model/ModelBlock;)Lnet/minecraft/client/renderer/block/model/ModelBlock; # makeItemModel
protected net.minecraft.client.renderer.block.model.ModelBakery func_177580_d(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/util/ResourceLocation; # getModelLocation
#public net.minecraft.client.renderer.block.model.WeightedBakedModel field_177565_b # models
# EnumFacing
public net.minecraft.util.EnumFacing field_82609_l # VALUES
public net.minecraft.util.EnumFacing field_176754_o # HORIZONTALS