Major Refactoring of Bootstrap Code (#75)
- Refactored boostrap code: * Completely reworked item/block/tile registration. * Fixed server side startup. * Fixed server side startup. * More documentation. * More heavy cleanup * More cleanups. * Major refactoring of state mapping and fixes a lot of other issue related to item rendering. * Fixes sky chest item models (no item TESR). * Only use CachingRotatingBakedModel for tile entities automatically. Fix default rotation of quartz pillar for item model. * Used method reference instead of lambda for ItemMeshDefinition for multiparts. * Removed unnecessary IHasSpecialItemModel * Removed unused IconReg class. * Updated resource pack version.
This commit is contained in:
committed by
Sebastian Hartte
parent
66df324ef0
commit
6f2bbfab4c
@@ -0,0 +1,42 @@
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemModelMesher;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
|
||||
/**
|
||||
* Registers the models that should by used for an item, including the ability to
|
||||
* distinguish by meta.
|
||||
*/
|
||||
public class ItemModelComponent implements InitComponent
|
||||
{
|
||||
|
||||
private final Item item;
|
||||
|
||||
private final Map<Integer, ModelResourceLocation> modelsByMeta;
|
||||
|
||||
public ItemModelComponent( @Nonnull Item item, @Nonnull Map<Integer, ModelResourceLocation> modelsByMeta )
|
||||
{
|
||||
this.item = item;
|
||||
this.modelsByMeta = modelsByMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize( Side side )
|
||||
{
|
||||
ItemModelMesher itemMesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
|
||||
|
||||
modelsByMeta.forEach( ( meta, model ) ->
|
||||
{
|
||||
itemMesher.register( item, meta, model );
|
||||
} );
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user