Skip to content

Commit

Permalink
Updated BlockStates to use directory structure
Browse files Browse the repository at this point in the history
Fixed player render layers loading order
Removed DirectionTransformers, remainder of TMT
Improved TMT's performance by removing unused features
  • Loading branch information
Pabilo8 committed Oct 4, 2024
1 parent 6dc98a0 commit bb49a2d
Show file tree
Hide file tree
Showing 61 changed files with 397 additions and 1,436 deletions.
160 changes: 99 additions & 61 deletions src/main/java/pl/pabilo8/immersiveintelligence/client/ClientProxy.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package pl.pabilo8.immersiveintelligence.client.util;

import blusunrize.immersiveengineering.client.IECustomStateMapper;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
import net.minecraft.util.ResourceLocation;
import pl.pabilo8.immersiveintelligence.common.IILogger;
import pl.pabilo8.immersiveintelligence.common.util.block.IIIStateMappings;

/**
* Custom {@link IBlockState} location mapper that allows to use meta-IDs
*
* @param <E>
*/
public class IICustomStateMapper<E extends Enum<E>> extends IECustomStateMapper
{
public static <E extends Enum<E>> StateMapperBase getStateMapper(IIIStateMappings<E> mappings)
{
return stateMappers.computeIfAbsent("ii_"+mappings.getMappingsName(), s -> new IICustomStateMapper<E>());
}

@Override
@SuppressWarnings("unchecked")
protected ModelResourceLocation getModelResourceLocation(IBlockState state)
{
try
{
assert state.getBlock() instanceof IIIStateMappings;
IIIStateMappings<E> mappings = (IIIStateMappings<E>)state.getBlock();
ResourceLocation rl = new ResourceLocation(Block.REGISTRY.getNameForObject(state.getBlock()).getResourceDomain(),
mappings.getMappingsName());

String custom = mappings.getMappingsExtension(state.getBlock().getMetaFromState(state), false);
if(custom!=null)
rl = new ResourceLocation(rl+"/"+custom);
return new ModelResourceLocation(rl, this.getPropertyString(state.getProperties()));
} catch(Exception e)
{
IILogger.error("Failed to get ModelResourceLocation for state %s, cause: %s", state, e);
ResourceLocation rl = Block.REGISTRY.getNameForObject(state.getBlock());
return new ModelResourceLocation(rl, this.getPropertyString(state.getProperties()));
}
}
}

This file was deleted.

Loading

0 comments on commit bb49a2d

Please sign in to comment.