More compile things

This commit is contained in:
covers1624
2020-06-02 15:12:30 +09:30
parent 404ef5624b
commit 3f5c299d09
111 changed files with 838 additions and 873 deletions
@@ -1,19 +1,22 @@
package appeng.client.render.model;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import java.util.function.Function;
import javax.annotation.Nullable;
import net.minecraft.client.renderer.block.model.IBakedModel;
import com.mojang.datafixers.util.Pair;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.IModelTransform;
import net.minecraft.client.renderer.model.IUnbakedModel;
import net.minecraft.client.renderer.model.Material;
import net.minecraft.client.renderer.model.ModelBakery;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.IModel;
import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.common.model.IModelState;
import net.minecraftforge.common.model.TRSRTransformation;
import appeng.core.AppEng;
@@ -21,11 +24,11 @@ import appeng.core.AppEng;
/**
* Model wrapper for the memory card item model, which combines a base card layer with a "visual hash" of the part/tile.
*/
public class MemoryCardModel implements IModel
public class MemoryCardModel implements IUnbakedModel
{
private static final ResourceLocation MODEL_BASE = new ResourceLocation( AppEng.MOD_ID, "item/memory_card" );
private static final ResourceLocation TEXTURE = new ResourceLocation( AppEng.MOD_ID, "items/memory_card_hash" );
private static final Material TEXTURE = new Material( AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "items/memory_card_hash" ) );
@Override
public Collection<ResourceLocation> getDependencies()
@@ -34,37 +37,19 @@ public class MemoryCardModel implements IModel
}
@Override
public Collection<ResourceLocation> getTextures()
public Collection<Material> getTextures( Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors )
{
return Collections.singletonList( TEXTURE );
return Collections.singleton( TEXTURE );
}
@Nullable
@Override
public IBakedModel bake( IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
public IBakedModel bakeModel( ModelBakery modelBakeryIn, Function<Material, TextureAtlasSprite> spriteGetterIn, IModelTransform transformIn, ResourceLocation locationIn )
{
TextureAtlasSprite texture = bakedTextureGetter.apply( TEXTURE );
TextureAtlasSprite texture = spriteGetterIn.apply( TEXTURE );
IBakedModel baseModel = this.getBaseModel( state, format, bakedTextureGetter );
IBakedModel baseModel = modelBakeryIn.getBakedModel( MODEL_BASE, transformIn, spriteGetterIn );
return new MemoryCardBakedModel( format, baseModel, texture );
}
private IBakedModel getBaseModel( IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
{
// Load the base model
try
{
return ModelLoaderRegistry.getModel( MODEL_BASE ).bake( state, format, bakedTextureGetter );
}
catch( Exception e )
{
throw new RuntimeException( e );
}
}
@Override
public IModelState getDefaultState()
{
return TRSRTransformation.identity().toItemTransform();
return new MemoryCardBakedModel( baseModel, texture );
}
}