Skip to content

Commit

Permalink
Fix crash when pipes are disabled (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
KnightMiner committed Jul 11, 2018
1 parent 2a53cb5 commit cde1b81
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
@@ -1,19 +1,16 @@
package knightminer.inspirations.library.client;

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;

public class IgnoreAllStateMapper extends StateMapperBase {

private final ModelResourceLocation location;
public IgnoreAllStateMapper(Block block) {
this.location = new ModelResourceLocation(block.getRegistryName(), "normal");
}
public static final IgnoreAllStateMapper INSTANCE = new IgnoreAllStateMapper();
private IgnoreAllStateMapper() {}

@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
return location;
return new ModelResourceLocation(state.getBlock().getRegistryName(), "normal");
}
}
Expand Up @@ -52,7 +52,7 @@ public void registerModels(ModelRegistryEvent event) {
setModelStateMapper(InspirationsUtility.carpetedPressurePlate2, carpetedPressurePlate);
setModelStateMapper(InspirationsUtility.collector, new StateMap.Builder().ignore(BlockCollector.TRIGGERED).build());
// using multipart, so ignore all states to save memory
setModelStateMapper(InspirationsUtility.pipe, new IgnoreAllStateMapper(InspirationsUtility.pipe));
setModelStateMapper(InspirationsUtility.pipe, IgnoreAllStateMapper.INSTANCE);

// blocks
registerItemModel(InspirationsUtility.torchLever);
Expand Down

0 comments on commit cde1b81

Please sign in to comment.