use of net.silentchaos512.gear.gear.material.MaterialInstance in project Silent-Gear by SilentChaos512.
the class CompoundPartModel method buildFakeModel.
private void buildFakeModel(Function<Material, TextureAtlasSprite> spriteGetter, ImmutableList.Builder<BakedQuad> builder, Transformation rotation, IMaterial material) {
// This method will display an example item for items with no data (ie, for advancements)
MaterialInstance mat = MaterialInstance.of(material);
IMaterialDisplay model = mat.getDisplayProperties();
MaterialLayer exampleMain = model.getLayerList(this.gearType, this.partType, mat).getFirstLayer();
if (exampleMain != null) {
builder.addAll(getQuadsForSprite(0, spriteGetter.apply(new Material(InventoryMenu.BLOCK_ATLAS, exampleMain.getTexture(this.texturePath, 0))), rotation, exampleMain.getColor()));
}
builder.addAll(getQuadsForSprite(0, spriteGetter.apply(new Material(InventoryMenu.BLOCK_ATLAS, new StaticLayer(PART_MARKER_TEXTURE).getTexture(this.gearType, 0))), rotation, Color.VALUE_WHITE));
}
use of net.silentchaos512.gear.gear.material.MaterialInstance in project Silent-Gear by SilentChaos512.
the class CompoundPartModelOverrideList method getOverrideModel.
private BakedModel getOverrideModel(ItemStack stack, @Nullable ClientLevel worldIn, @Nullable LivingEntity entityIn) {
List<MaterialLayer> layers = new ArrayList<>();
PartData part = PartData.from(stack);
MaterialInstance primaryMaterial = CompoundPartItem.getPrimaryMaterial(stack);
if (part != null && primaryMaterial != null) {
addWithBlendedColor(layers, part, primaryMaterial, stack);
}
return model.bake(layers, "test", owner, bakery, spriteGetter, modelTransform, this, modelLocation);
}
use of net.silentchaos512.gear.gear.material.MaterialInstance in project Silent-Gear by SilentChaos512.
the class FragmentModel method buildFakeModel.
private void buildFakeModel(Function<Material, TextureAtlasSprite> spriteGetter, ImmutableList.Builder<BakedQuad> builder, Transformation rotation, IMaterial material) {
// This method will display an example item for items with no data (ie, for advancements)
MaterialInstance mat = MaterialInstance.of(material);
IMaterialDisplay model = mat.getDisplayProperties();
MaterialLayer exampleMain = model.getLayerList(GearType.FRAGMENT, PartType.MAIN, mat).getFirstLayer();
if (exampleMain != null) {
builder.addAll(getQuadsForSprite(0, spriteGetter.apply(new Material(InventoryMenu.BLOCK_ATLAS, exampleMain.getTexture(GearType.FRAGMENT, 0))), rotation, exampleMain.getColor()));
}
}
use of net.silentchaos512.gear.gear.material.MaterialInstance in project Silent-Gear by SilentChaos512.
the class CompounderTileEntity method getInputs.
private MaterialList getInputs() {
boolean allEmpty = true;
for (int i = 0; i < getInputSlotCount(); ++i) {
ItemStack stack = getItem(i);
if (!stack.isEmpty()) {
allEmpty = false;
break;
}
}
if (allEmpty) {
return MaterialList.empty();
}
MaterialList ret = MaterialList.empty();
for (int i = 0; i < getInputSlotCount(); ++i) {
ItemStack stack = getItem(i);
if (!stack.isEmpty()) {
MaterialInstance material = MaterialInstance.from(stack);
if (material != null && material.get().isSimple()) {
ret.add(material);
} else {
return MaterialList.empty();
}
}
}
return ret;
}
use of net.silentchaos512.gear.gear.material.MaterialInstance in project Silent-Gear by SilentChaos512.
the class GraderTileEntity method tick.
public static void tick(Level level, BlockPos pos, BlockState state, GraderTileEntity blockEntity) {
// Don't waste time if there is no input or no free output slots
ItemStack input = blockEntity.getInputStack();
if (input.isEmpty())
return;
int outputSlot = blockEntity.getFreeOutputSlot();
if (outputSlot < 0)
return;
ItemStack catalyst = blockEntity.getCatalystStack();
int catalystTier = getCatalystTier(catalyst);
if (catalystTier < 1)
return;
MaterialInstance material = MaterialInstance.from(input);
if (material != null && material.getGrade() != MaterialGrade.getMax()) {
if (blockEntity.progress < BASE_ANALYZE_TIME) {
++blockEntity.progress;
}
if (blockEntity.progress >= BASE_ANALYZE_TIME && !level.isClientSide) {
blockEntity.progress = 0;
catalyst.shrink(1);
blockEntity.tryGradeItem(input, catalystTier, material);
}
} else {
blockEntity.progress = 0;
}
// if (requireClientSync) {
// BlockState state = world.getBlockState(pos);
// world.notifyBlockUpdate(pos, state, state, 3);
// requireClientSync = false;
// }
}
Aggregations